Mostly work related stuff which I would've entered into my "Log book". Instead of hosting it on an intranet site, outsourcing the hosting to blogger!
Sunday, July 08, 2018
Google Home Mini - a mini review
Tuesday, July 03, 2018
packet sniffing wifi
https://osqa-ask.wireshark.org/questions/61656/promiscuous-mode-not-working
https://wiki.wireshark.org/CaptureSetup/WLAN#Monitor_mode
Then the packets have to be decrypted.
https://wiki.wireshark.org/HowToDecrypt802.11
For that, if using WEP, the WEP password has to be converted to the Hexadecimal key -
http://corecoding.com/utilities/wep2hex.php
change Google Home mini wifi settings without Google Assistant app
Friday, June 29, 2018
ITR2 - paying income tax
Friday, June 22, 2018
blender z axis flip
Just a quick recipe for flipping an object in Blender -
- Select object
- Ctrl A (for Apply)
- Choose Scale
- Enter Z scale as -1
- Ensure that scale checkbox is ticked under apply.
Wednesday, May 30, 2018
unhelpful error message - google groups
Apparently this has nothing to do with internet connectivity issues. These forum posts point to a bad email id in the submitted batch. Sure enough, there was a "blogger.com" email id in the batch which was causing problems for me. Removed it, all well.
Tuesday, May 29, 2018
Google Apps legacy documentation
Wednesday, May 16, 2018
opencv contrib modules need compiling on Windows
A guide to compiling the contrib modules of OpenCV on Windows -
https://putuyuwono.wordpress.com/2015/04/23/building-and-installing-opencv-3-0-on-windows-7-64-bit/
Friday, May 11, 2018
Linux Mint Live CD / DVD
- username is mint, and no password.
- sudo does not ask for password.
- to take a backup, can do sudo cp -R /source/folder /destination/folder
- to switch between screens, Ctrl+Alt+F2 or Ctrl+Alt+F7 etc - need to press Fn also on Mac keyboard.
web hosting on github
https://help.github.com/articl
https://pages.github.com/
The limits are quite generous - https://help.github.com/
"GitHub Pages sites are subject to the following usage limits:
- GitHub Pages source repositories have a recommended limit of 1GB .
- Published GitHub Pages sites may be no larger than 1 GB.
- GitHub Pages sites have a soft bandwidth limit of 100GB per month.
- GitHub Pages sites have a soft limit of 10 builds per hour."
Sunday, May 06, 2018
C++ programming - using fstream in a cross-platform manner
Some notes about making use of fstream in cross-platform code -
Some interesting methods are discussed at
https://stackoverflow.com/questions/9739948/write-a-file-in-a-specific-path-in-c/40980510#40980510
In Visual Studio,
disable deprecation, use _CRT_SECURE_NO_WARNINGS -
Configuration Properties >> C/C++ >> Preporocessor >> Preprocessor Definitions >> _CRT_SECURE_NO_WARNINGS
A working code snippet -
char path[80];
char foldername[80];
sprintf(path,"homeuser/file.txt");
sprintf(foldername, "homeuser");
CreateDirectoryA(foldername, NULL);
std::ofstream file(path); //open in constructor
std::string data("data to write to file");
file << data;
Friday, May 04, 2018
making an alexa skill
There was already a Radio Sai skill, but that one was missing AfriStream and AsiaStream. So, decided to try to implement this skill, with some improvements, as an official radiosai skill.
Changes in the user interface - the screenshots given here are no longer similar to Amazon's AWS console or the Skills console. Instead of uploading the sample utterances as a text file, I manually created the utterances in the Skill console using the wizard. Also added some confirmation before playing each stream, like
var message = 'Playing Bhajan Stream.'; this.response.speak(message); this.attributes['stream'] = 'BhajanStream'; controller.play.call(this);
and also added a stop call to the AudioPlayer -
'AMAZON.CancelIntent' : function () {
// adding the line below to stop the audio player
controller.stop.call(this);
//////////////
var message = 'Good bye.';
this.response.speak(message);
this.emit(':responseReady');
}
It looks like only the playModeIntentHandlers are active - the others don't seem to be called. Have submitted for being made available to the public.
Edit: Update May 11 -
1. Bug fixes by the owner of this repository, looks like the SDK had some changes so the zip file needed to be changed.
2. How to build an Alexa audio streaming skill from a template - YouTube video - lots of similar resources available
3. Audio player skill sample from Amazon, for multiple streams.
Wednesday, April 25, 2018
free alternatives to Zemax
https://www.quora.com/What-are-some-open-source-free-Optical-design-software-packages-similar-to-Zemax-CodeV-available-for-Windows
"My experience with free software gives me the impression that they are good enough to learn about lens design and optics, but not good enough to do serious (=paid) work."
lightmachinery.com/optical-
Saturday, April 21, 2018
free video editor - DaVinci Resolve
https://www.reddit.com/r/AskReddit/comments/8dp8ui/whats_the_best_free_software_out_there_that_you/
A video editor with lots of features - DaVinci Resolve, and also, of course, Blender.
Tuesday, April 17, 2018
Notes on compiling software lockin amplifier
Friday, April 13, 2018
USB to TTL link dump
A collection of links about communicating with serial control lines over USB - Arduino etc -
- Communicating via the USB-to-TTL-Serial Adapter - https://www.pololu.com/docs/0J36/6
- https://www.xanthium.in/Serial-Port-Programming-on-Linux
- Using CTS / DSR - last part of https://stackoverflow.com/questions/209603/steps-to-make-a-led-blink-from-a-c-c-program
- https://stackoverflow.com/questions/957337/what-is-the-difference-between-dtr-dsr-and-rts-cts-flow-control
- No RTS pins for low cost board - need FTDI board - detailed tech info -
https://www.adafruit.com/product/954 via the quora link below, - https://www.quora.com/What-is-a-TTL-signal-in-communication-and-when-using-a-USB-port-why-do-we-use-a-USB-to-TTL-converter - "The so-called USB to TTL converter is actually a USB Serial Port to CMOS Logic-Level Serial Port converter."
- Using select() for microsecond delay -
https://www.experts-exchange.com/questions/20556300/how-insert-a-delay-in-microseconds-in-C-under-VC.html
https://stackoverflow.com/questions/1157209/is-there-an-alternative-sleep-function-in-c-to-milliseconds
https://pubs.opengroup.org/onlinepubs/000095399/functions/select.html - Processing.org - interesting resource for graphing the output, even from an Arduino. Tutorial -
https://itp.nyu.edu/physcomp/labs/labs-serial-communication/serial-output-from-an-arduino/ - libusb.info - crossplatform
- https://playground.arduino.cc/Interfacing/LinuxTTY - interesting shell tricks
- https://chrisheydrick.com/2012/06/13/how-to-read-serial-data-from-an-arduino-in-linux-with-c-part-2/ links to
- "Tod Kurt’s blog has an excellent write-up and fantastic example program for reading and writing serial data to/from an Arduino." - and http://todbot.com/blog/2013/04/29/arduino-serial-updated/
- Things to try if tty is not writable - https://ubuntuforums.org/showthread.php?t=2333167
Tuesday, April 10, 2018
bouncing emails in google groups
Maintaining google group by deleting bounced emails. And if needed, re-adding them.
https://support.google.com/a/answer/7552660?hl=en
Edit: Users can reset their bounce status by going to https://groups.google.com/bounced?pli=1 or https://groups.google.com/a/example.com/groups/bounced?pli=1
next to Bounce Status, email status -> Reset bounce status. (which appears only if it is bouncing.)
Monday, April 09, 2018
Arduino IDE on Linux Mint
From https://playground.arduino.cc/Linux/Mint/ -
we should probably not use
sudo apt install arduino
because it is outdated or non-standard, and we should instead use the 64 bit binary from
https://www.arduino.cc/en/Main/Software
Saturday, April 07, 2018
email slowdown and possible fixes
1. For some gmail emails, the server was trying the ipv6 address, and not able to reach it - like
Mar 25 09:34:15 krishna postfix/smtp[19788]: connect to gmail-smtp-in.l.google.com[2404:6800:4003:c03::1b]:25: Network is unreachable
Mar 25 09:34:28 krishna postfix/smtp[20163]: connect to ASPMX.L.GOOGLE.COM[2404:6800:4003:c02::1b]:25: Network is unreachable
This was probably due to a router change at the Studio.
Did this -
https://support.plesk.com/hc/en-us/articles/213398289-Specifying-Postfix-configuration-of-IPv4-IPv6-protocol-support
ie
adding the option:
inet_protocols=ipv4
to the /etc/postfix/main.cf Postfix configuration file. And then as root,
# postfix reload
# service postfix restart
That worked, the emails went out. But the email sending rate was only around 1000 emails per hour, as reported by
# qshape incoming active deferred
2. A lot of mails were being deferred instead of bounced by gmail, OverQuotaTemp.
cat /var/log/mail.log | grep OverQuotaTemp | wc -l
5878
PB unconfirmed those emails using
cat /var/log/mail.log | grep OverQuotaTemp | grep 'to=' | grep -o '[[:alnum:]+\.\_\-]*@[[:alnum:]+\.\_\-]*' | sort | uniq -i
Then also for bouncing emails, like
cat /var/log/mail.log | grep "does not exist"
cat /var/log/mail.log.1 | grep "does not exist"
cat /var/log/mail.log.1 | grep "553 Mail from 111.93.16.162 not allowed"
cat /var/log/mail.log | grep "status=bounced"
cat /var/log/mail.log.1 | grep "status=bounced"
3. Mails were still going out slowly, with the usage on the internet port being like
Thursday, April 05, 2018
notes on startup / shutdown times
Linux vs Windows 7 brief speed test
Thursday, March 29, 2018
finding ip ranges via ASN
https://www.quora.com/How-can-
https://www.peeringdb.com/net/1903 has Airtel's ASN.
Then, we can use that ASN in this whois query -
whois -h whois.radb.net -- '-i origin AS9498' | grep -Eo "([0-9.]+){4}/[0-9]+" > airtel.txt
whois -h whois.radb.net -- '-i origin AS9829' | grep -Eo "([0-9.]+){4}/[0-9]+" > bsnl.txt
Wednesday, March 28, 2018
boot from grub - link dump
root (hd0,0)
makeactive
chainloader --force +1
boot
But grub 2 is different.
https://www.linux.com/learn/how-rescue-non-booting-grub-2-Linux
grub> set root=(hd0,1)
grub> linux /vmlinuz root=/dev/sda1
grub> initrd /initrd.img
grub> boot
set prefix=(hd1,1)/grub
set root=(hd1,1)
insmod normal
normal
https://www.aioboot.com/en/boot-windows-grub2/
from grub rescue prompt,
search -s root -f /NTDETECT.COM
drivemap -s hd0 $root
ntldr /ntldr
boot
https://www.gnu.org/software/grub/manual/grub/grub.html#DOS_002fWindows
parttool (hd0,1) hidden-
parttool (hd0,2) hidden+
set root=(hd0,1)
chainloader +1
parttool ${root} boot+
boot
https://www.aioboot.com/en/boot-windows-grub2/
http://forums.justlinux.com/showthread.php?153121-Fun-with-GPT-partitioning
unable to make XP boot from a cloned volume on Intel Mac
Just a few lines of notes - trying making other partitions hidden to make XP boot - doesn't work, since partition is GPT, grub says hidden - unknown argument or whatever.
using dd to clone a usb drive
From
https://www.garron.me/en/bits/convert-store-copy-bootable-usb-iso-file-another-usb.html
- use df to find the device name, then
- dd if=/src/dev/path of=/dest/dev/path conv=notrunc
for example dest can be a file also -
dd if=/dev/sdc of=/home/user/backup-usb.dd conv=notrunc
(notrunc is useful only when writing to a file, https://stackoverflow.com/questions/20526198/why-using-conv-notrunc-when-cloning-a-disk-with-dd )
Tuesday, March 27, 2018
Linux Mint 18.1 not booting - solved
apt remove virtualbox-guest*
and rebooted OK.
Monday, March 26, 2018
link dump - ALSA etc - for software lock-in amplifier
QApplication and Qwidgets derived classes are in widgets module in Qt 5 so to fix that you need to add QT += widgets in the .pro file and run qmake and also use #include <QApplication> instead of #include <QtGui/QApplication> (and the code becomes compatible with both Qt 4 and 5), you can read more here
https://help.ubuntu.com/
Thursday, March 22, 2018
link dump for triple boot of Windows, Linux and MacOS on Macbook
1. https://lifehacker.com/how-to-
https://medium.com/@
2. Brief notes: Using rEFInd, need to allow drive to spin up for it to be visible on refind.
usb drive not seen with refind.
Windows XP installer did not allow installation to partition which was created after the mac partition, so creating a new partition by moving the mac partition - 8 hours!
3. EFI fix - https://apple.stackexchange.
Tried gdisk -> Advanced -> H
Finally. Install Mint alongside other partitions.
4. https://www.tecmint.com/
5. EFI - Created with Linux mint install graphical using 200 MB at beginning.
Edit: 7 Nov 2019 - https://www.intowindows.com/
Edit: 2 Jan 2021 - Possibly a portable Win10 using WintoUSB may be the easiest option, for Windows 7 and higher versions of Windows - the Macbook is supposed to boot from CD if we press and hold the C key. https://en.wikipedia.org/wiki/WinBuilder#Actively_developed_projects
Wednesday, March 21, 2018
recovering after overwriting EFI partition
In the process, the EFI boot partition was overwritten. So, the machine would not boot. Tried creating a refind boot USB drive - that showed up the Mac and Linux boot loaders, but did not boot either of them - the Linux boot ended in an emergency shell, and the Mac boot ended with the Mac apple turning into a cross, and not booting.
Googled various options, and thought the easiest way would be to do another Linux install. Made another Linux Mint installable USB drive by doing dd of the Mint 18.3 iso to a 16 GB drive, recreated an EFI partition using the installer's GUI partitioning tool, installed the 18.3 to another partition created in free space, and after install, the 18.3 and MacOS were successfully booting.
The original Linux Mint 18.1 was still not booting - dropping into emergency shell. 'Welcome to emergency mode! After logging in, type "journalctl -xb" to view system logs, "systemctl reboot" to reboot, "systemctl default" to try again to boot into default mode.'
journalctl -xb showed that the reason for not booting up was that it was not able to mount /boot/efi with UUID - the UUID had changed, of course, since the boot partition had been re-created. So, just booted into the new 18.3 Linux install, mounted the 18.1 volume, sudo nano edited the /etc/fstab with the UUID from the 18.3's /etc/fstab, and then rebooted - all OK.
Here are some of the things I googled and found - something like rough notes -
enabling bios mode
https://superuser.com/question
https://discussions.apple.com/
https://support.apple.com/en-i
https://kb.wisc.edu/helpdesk/p
https://ubuntuforums.org/showt
https://ubuntuforums.org/showt
https://askubuntu.com/
Saturday, March 17, 2018
Unified Threat Management - UTM devices, proxies etc
https://www.quora.com/Which-is-the-best-Open-Source-Unified-Threat-Management-System-UTM-in-the-market
mentions ClearOS
http://jonmoore.duckdns.org/index.php/network-security/32-open-source-utm
reviews pfsense , untangle and sophos. He has an additional VPN requirement.
Comodo offers a free download.
https://www.google.co.in/search?q=set+up+a+unified+threat+management+appliance+with+open+source+software
For squid tuning, cache size etc,
https://forum.pfsense.org/index.php?topic=24429.0
where a user suggests, for an admin who has trouble with 70 users,
I recommend use 10KB to 16KB(thumbnail picture size) for object size.
On restart COSS contents will be lost(developent still on progress for this issue)
for your memory issues:
squid/lusca would use 10MB per GB of total cache(when full).
http://wiki.squid-cache.org/SquidFaq/SquidMemory#How_much_memory_do_I_need_in_my_Squid_server.3F
If your system starts to use SWAP file(due to lack of RAM) then it will definitely slows your internet.
Squid/lusca starts to grow Page faults it also affects performance.
You might need to consider changing your cache_mem and give them to your OS.
This FAQ would help you.
http://wiki.squid-cache.org/SquidFaq
Tuesday, March 13, 2018
temporary router
1. Editing /etc/network/interfaces to give our mail server a public id (earlier it was in the DMZ)
2. Physically connecting the server with LAN cable to one of the ports of the router.
3. Going to NAT Access Control under Network Options on the router's config page, to disable NAT for the mail server.
Sunday, March 11, 2018
lines seen on camera capture with new SDK
With QHYCCD's new SDK, lines were seen on captures. But on further study, found that the lines were seen when phone LED or LCD screen of computer is used as illumination, not otherwise.
So this is probably due to the effect of the rolling shutter + the repetition rate of the illumination.
We checked with sunlight - no lines - and with SLED illumination - no lines. So we are probably all good.
Wednesday, March 07, 2018
ways to add files to github
https://help.github.com/
https://help.github.com/
https://help.github.com/
but also via web interface, which would be easier for me,
https://help.github.com/articles/adding-a-file-to-a-repository/
and creating a new file inside a new folder by directly typing the path like doc/newfile.md etc
https://stackoverflow.com/questions/18773598/creating-folders-inside-github-com-repo-without-using-git
Tuesday, March 06, 2018
Windows executable slower
Edit - my analysis above seems to be wrong - the code only had the Hilbert transform (and hence the DFT) on press of s key - and the fps was low even when no keys were being pressed. Some other bottleneck. Display driver?
QHY SDK - Windows and Linux
My query was:
The reply was that the 6e error is the readout noise. The rest of the noise is probably shot noise.
https://github.com/qhyccd-lzr/
The QHY team did not reply, but I found that the Windows and Linux SDKs have a different range for the Gain parameter, and probably for other parameters as well! The Linux SDK (Software Development Kit) and the Windows SDK are developed by different teams. So, the same functions have different implementations! For example, gain goes from 1-100 in the Linux SDK we tested. But gain goes 1-480 in the latest Windows SDK.
Sunday, March 04, 2018
cross platform issues
- Install the latest Visual Studio Community edition (v. 15, Visual Studio 2017). OpenCV's latest binaries only work with v14 and v15, and if we use some other version of VS, we would have to recompile opencv, which would be a pain.
- Install the latest QHY SDK from http://www.qhyccd.com/SWHIST_SDK.html - the latest version of the SDK has the lib files, h files and so on in addition to the dll binaries. Currently the latest version is at the bottom of the page!
- Install the latest version of OpenCV for Windows from sourceforge, following the instructions at https://docs.opencv.org/2.4/doc/tutorials/introduction/windows_install/windows_install.html
- The instructions on how to build an opencv application, https://docs.opencv.org/2.4/doc/tutorials/introduction/windows_visual_studio_Opencv/windows_visual_studio_Opencv.html#windows-visual-studio-how-to
is reasonably similar to what we need to do, except for the fact that it would be better if we create a new property sheet called common and save it for future use as mentioned in the next point below - VS15 does not recommend .user property sheets. - In a newly created property sheet (called common, for reuse), add the additional include directories, linker files etc as mentioned in the documentation on point 4 above. Here, we need to add the QHY SDK includes and dlls also. The opencv libraries are now distributed as a single file, opencv_world.lib and not the multiple lib files as in the documentation above. So, in short,VC++ directories -> IncludeLinker General -> Additional Library directoriesLinker Input -> names of the lib files in Additional Dependencies
- The .cpp files need to have ifdefs for linux and windows standard headers separately. Code can be seen at https://github.com/hn-88/ASKlive/blob/master/ASKlive.cpp
- For the C function sprintf to work, the following pre-processor directive has to be added - C++ -> Preprocessor - > Preprocessor definitions -> add _CRT_SECURE_NO_WARNINGS
- In order to copy over the required DLLs, the following post build event has to be added -
xcopy /y /d "D:\qhy\*.dll" "$(OutDir)"
xcopy /y /d "$(OPENCV_DIR)\bin\*.dll" "$(OutDir)"
It is safer to copy to the executable's directory, since there is quite a bit of confusion about copying to system folders - http://www.forceflow.be/2012/04/04/the-3264-bit-dll-confusion-on-windows-64-bit/ - Arrays have to be pre-assigned sizes - can't be assigned sizes at runtime as with GNU C compiler.
SetErrorMode(SEM_ FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
Raspberry PI configuration link dump
- Impressive - The Raspberry Pi 3 boots up in 25 seconds to Desktop. 10 seconds to open Chromium browser. 25 seconds to load a google spreadsheet. Overall, faster than my AMD64 Windows XP laptop from 2009. :)
- Older version of RPi (Pi2?) - good for playing local videos - was pleasantly surprised to find that I could just put in the same micro-SD card which was running Raspbian 9 into a SD-card adapter and put it into the older Pi, and it booted and ran fine - did not need any reinstall.It is good for playing local videos. It could play 2 windows with 2 instances of VLC running local copies of 360p videos without any problems - 35% CPU for each instance, MP4 and DIVX respectively. But it could not play videos reliably over the network. Also, web browser Chromium takes a very very long time to open, web pages crawl to load. Probably because of the low RAM.But I can use it as a video player, with a status message at the bottom or something like that.
- Ubuntu 64 bit on the new Pi - https://www.raspberrypi.org/forums/viewtopic.php?t=220079sudo cp ~/Desktop/pi-bootloader/boot/* /mntInstead, doing this -with the image at
- Only xubuntu available for Pi - https://linuxconfig.org/
install-ubuntu-16-04-mate-or- ubuntu-18-04-on-raspberry-pi# h7-1-ubuntu-server-unofficial - wifi driver installation - https://www.youtube.com/watch?
v=nlLS8d4Z09c lspci -vvnn | grep 802lsusb does not show it when driver is not installed. - Cloning RPi with dd - https://www.raspberrypi.org/forums/viewtopic.php?t=46911
sudo fdisk -l
sudo dd bs=4M if=/dev/sdc | gzip > /home/your_username/image`date +%d%m%y`.gz
sudo gzip -dc /home/your_username/image.gz | dd bs=4M of=/dev/sdc - Enabling monitoring on RPi wifi - https://raspberrypi.stackexchange.com/questions/36747/enable-monitoring-mode-for-rtl8188cus-via-usb-on-raspbian
- How to loop in VLC - https://forum.videolan.org/viewtopic.php?t=78723 - and subtitles in vlc playlist maker.
- Adjusting Overscan on the RPi - https://retropie.org.uk/forum/topic/2371/using-composite-video-can-t-see-everything-on-the-screen/16
- Raspberry PI model comparison - http://socialcompare.com/en/comparison/raspberrypi-models-comparison
- Shortcut to edit text file - Exec=leafpad %U /home/pi/file.txt
Saturday, March 03, 2018
securing lighttpd
Brief notes on securing lighttpd, the light-weight web-server -
# deny access to all files below a certain path
$HTTP["url"] =~ "/certain-path/" { url.access-deny = ("") }
# deny access on all jpeg images to the Google bot
$HTTP["useragent"] =~ "Google" { url.access-deny = (".jpg") }
# deny access by referrer
$HTTP["referrer"] !~ "^($|www.ourhost.com)" {
url.access-deny = ("")
}
Friday, March 02, 2018
QHY camera glitch
Tried on another Linux machine - Acer running Ubuntu 16 - without any drivers installed - again, no dmesg messages.
Tried changing the USB cable - then a dmesg message was seen, detecting on a 'slow port'. Tried on the Macbook again after reinstalling the new SDK, now it was showing dmesg messages as well as LED lighting up - detected OK. Changed back to the original USB cable - everything still OK.
So, probably a combination of hardware and firmware issues.




