Wednesday, April 25, 2018

Tuesday, April 17, 2018

Notes on compiling software lockin amplifier

Abbreviated notes from the software lock-in amplifier at https://github.com/hn-88/SoftwareLockin/

French lockin works on USB stick. Lubuntu 12.04

edited the pro files to add
QT += widgets

vumeter.h:40:25: fatal error: QtGui/QWidget: No such file or directory
on Mint 18.1

edit h files to make QtGui/QWidget QWidget

make clean
qmake multi.pro
make


error: ‘const class QString’ has no member named ‘toAscii’ - solved using

(was solved by install of package qttools5-dev-tools
more info here...) not used

QByteArray QString::toAscii() const
Returns an 8-bit representation of the string as a QByteArray.

This function does the same as toLatin1().

So, replaced in lockin.cpp and dockoutput.cpp

output has NaN

Edit: 20 Apr
ui_lockingui.h:13:29: fatal error: QtWidgets/QAction: No such file or directory
compilation terminated.
Makefile:406: recipe for target 'lockingui.o' failed
make: *** [lockingui.o] Error 1

probably have to find replace again?

Also QWidgets/QApplication

changed to QApplication etc - find replace QWidgets/ with nothing.

sudo apt-get --reinstall install libqt4-opengl-dev

Maybe if I upload the makefile?



Friday, April 13, 2018

USB to TTL link dump

A collection of links about communicating with serial control lines over USB - Arduino etc - 

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

From March 24 or 25, our mailing list started having a lot of delays in email sending, especially to gmail.com. Found the following issues:

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

Next try was to speed up sending to gmail.com domain, since the other emails were going out OK. Then, added these two lines to /etc/postfix/main.cf - 

maximal_queue_lifetime = 2d
default_destination_concurrency_limit = 100

decreasing lifetime from 5d to 2d and increasing concurrency limit from 20 to 100. That seemed to improve things - the outgoing rate went up to almost the peak rate - 

and from the next day, the emails were going out like









Thursday, April 05, 2018

notes on startup / shutdown times

On a machine with dual boot,

Time taken for Windows 7 to boot, open firefox and open youtube.com - 3:30 minutes.
Time taken for Linux Mint 18.3 to boot, open firefox and open youtube.com - 1:15 minutes.
Similarly, Windows takes 40 seconds to shut down, while Linux shuts down in less than ten seconds.
Equivalent of Hotspot Shield, if you want to watch something which is blocked - have installed PureVPN extension for both Chrome and Firefox...

Linux vs Windows 7 brief speed test

N's Lenovo B640 laptop had become old and slow. Tried dual booting with Linux Mint, found quite an improvement. 

Time taken for Windows 7 to boot, open firefox and open youtube.com - 3:30 minutes.

Time taken for Linux to boot, open firefox and open youtube.com - 1:15 minutes.

Similarly, Windows takes 40 seconds to shut down, while Linux shuts down in less than ten seconds.

Thursday, March 29, 2018

finding ip ranges via ASN

To obtain all the IP ranges of an ISP or large organization, got a procedure from this quora post -

https://www.quora.com/How-can-I-obtain-a-list-of-IP-addresses-owned-by-a-specific-company-I-would-like-to-provide-a-targeted-offer-to-site-visitors-if-they-work-at-a-certain-company-I-would-like-to-get-a-list-of-the-IP-addresses-that-this-organization-owns


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

https://www.linuxquestions.org/questions/linux-software-2/booting-windows-from-the-grub-prompt-275446/

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

https://unix.stackexchange.com/questions/77263/use-grub-rescue-to-boot-from-windows-xp-partition-cd-or-usb

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

Tuesday, March 27, 2018

Linux Mint 18.1 not booting - solved

Linux Mint was not booting into graphical mode. It was not even dropping me into an emergency shell - a dialog box about not being able to connect to upstart would appear, your session lasted only 10 seconds etc, and the window manager would restart. Initially I thought this was due to some problem related to booting as in my previous post. But then, saw this post on the Linux Mint forums. So, hit Ctrl Alt F2 to get a shell, (in my case, fn+Ctrl+Option, since this is a Macbook), did
  apt remove virtualbox-guest*
and rebooted OK. 

Monday, March 26, 2018

link dump - ALSA etc - for software lock-in amplifier

ALSA tutorial for beginners - 2004 - http://www.linuxjournal.com/article/6735?page=0,1


Checking the code and compiling from https://www.av8n.com/physics/lockin.htm

http://www.qtcentre.org/threads/53452-QtGui-QApplication-No-such-file-or-directorty

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

Or download 10.04,
and
https://help.ubuntu.com/community/Installation/FromUSBStick#Install_and_run_Startup_Disk_Creator_alias_usb-creator

Thursday, March 22, 2018

link dump for triple boot of Windows, Linux and MacOS on Macbook

1. https://lifehacker.com/how-to-run-a-portable-version-of-windows-from-a-usb-dri-1565509124


https://medium.com/@manujarvinen/setting-up-a-multi-boot-of-5-linux-distributions-ca1fcf8d502

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.com/questions/57597/how-to-fix-broken-efi-partition

https://www.kubuntuforums.net/showthread.php/43221-GRUB-2-A-Guide-for-Users/page15?p=379352#post379352

Tried gdisk -> Advanced -> H

Finally. Install Mint alongside other partitions.

4. https://www.tecmint.com/command-line-tools-to-monitor-linux-performance/

5. EFI - Created with Linux mint install graphical using 200 MB at beginning.

Edit: 7 Nov 2019 - https://www.intowindows.com/how-to-create-live-usbcddvd-of-vistaxp/


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 keyhttps://en.wikipedia.org/wiki/WinBuilder#Actively_developed_projects


restoring to a different path

 A link dump on restoring a cloned disk to a different path - 



Wednesday, March 21, 2018

recovering after overwriting EFI partition

Tried to install Windows XP on the Macbook running OS X 10.6 and Linux Mint 18.1 dual boot. Though a new primary partition was created at the beginning of the drive, Windows XP refused to install on it, saying there are too many partitions.



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/questions/1133040/unable-to-boot-into-windows-10-with-refind-solved/1133052
Ctrl R for safe boot into OS X
https://kb.wisc.edu/helpdesk/page.php?id=7197



Saturday, March 17, 2018

Unified Threat Management - UTM devices, proxies etc

In the context of an outage of our Cyberoam device, and the general decrepitness of the college proxies, I took a look at some available options, tuning 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

PB sent me his configuration changes when he put in a 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.