Skip to content

Instantly share code, notes, and snippets.

palaniraja palaniraja

Block or report user

Report or block palaniraja

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@palaniraja
palaniraja / auto-shutdown.sh
Last active Jun 22, 2018
auto-shutdown on higher temprature for raspberrypi - kill kodi & fbi along - copied from raspberrypi forum
View auto-shutdown.sh
#!/bin/sh
# This script reads the Broadcom SoC temperature value and shuts down if it
# exceeds a particular value.
# 80ºC is the maximum allowed for a Raspberry Pi.
# Get the reading from the sensor and strip the non-number parts
SENSOR="`/opt/vc/bin/vcgencmd measure_temp | cut -d "=" -f2 | cut -d "'" -f1`"
# -gt only deals with whole numbers, so round it.
TEMP="`/usr/bin/printf "%.0f\n" ${SENSOR}`"
# How hot will we allow the SoC to get?
@palaniraja
palaniraja / merge-mp4.sh
Last active Oct 26, 2019
Bash script to merge all mp4 videos in current directory (recursively 2 levels). It also updates the chapter marks to retain the folder/filename of source dir
View merge-mp4.sh
#!/bin/bash
## Script to merge all mp4 videos in current directory (recursively 2 levels)
## And update chapter marks to retain the folder/filename
## Script for merging videos
filename=`basename pwd`
current=`pwd`
@palaniraja
palaniraja / camera-lens.xml
Created Jun 14, 2018
My Canon SLR lens - optics info from lensfun
View camera-lens.xml
<xml>
<lens>
<maker>Canon</maker>
<model>Canon EF-S 18-55mm f/3.5-5.6 IS II</model>
<mount>Canon EF-S</mount>
<!-- Average crop factor of Canon APS-C cameras -->
<cropfactor>1.611</cropfactor>
<calibration>
<distortion model="ptlens" focal="18" a="0.02504" b="-0.06883" c="0.01502"/>
<distortion model="ptlens" focal="24" a="0.0203" b="-0.06514" c="0.04768"/>
@palaniraja
palaniraja / automount-usbmount.md
Last active Jun 11, 2018
Raspberry Pi - Automount - usb drives using usbmount - and share drives via samba
View automount-usbmount.md

Installation of packages

sudo apt-get install usbmount
sudo apt-get install samba samba-common-bin
sudo apt-get install ntfs-3g

Setup Samba

View automount.md

Did not work for me with raspberry pi

/etc/udev/rules.d/usbstick.rules

ACTION=="add", KERNEL=="sd[a-z][0-9]", TAG+="systemd", ENV{SYSTEMD_WANTS}="usbstick-handler@%k"

/usr/local/bin/automount

@palaniraja
palaniraja / medium-declutter
Created May 14, 2018
Medium blog - Declutter bookmarklet
View medium-declutter
javascript:(function(){%20var%20style%20=%20document.createElement(%27style%27),%20styleContent%20=%20document.createTextNode(%27.js-stickyFooter,%20.js-postShareWidget,%20.js-metabar%20{%20display:none%20!important;%20}%20.postArticle--full%20.sectionLayout--insetColumn{%20max-width:none%20!important;%20}%20%27);%20style.appendChild(styleContent%20);%20var%20caput%20=%20document.getElementsByTagName(%27head%27);%20caput[0].appendChild(style);%20})();
@palaniraja
palaniraja / img-diff.sh
Created May 2, 2018
image magick - image diff in batches
View img-diff.sh
# 62 is the no. of images (1.png ... 62.png in "v1/v2" directory)
for i in $(seq 62 $END); do magick compare ../v1/$i.png ../v2/$i.png diff-$i.png; done
@palaniraja
palaniraja / geektool.shell.sh
Last active Mar 3, 2019
Geek tool scripts I use with my desktop
View geektool.shell.sh
# to list todo's from todotxt file - refersh every 900 sec
cat /Users/palaniraja/Dropbox/Personal/orgmode/todo.txt | grep -v ^x\ | cut -c 12- | awk '{print "* " $0}'
# calendar events - next 5 days grouped by date - refresh every 1800 sec
/usr/local/bin/icalbuddy -nc -sd eventsToday+5
# previous month - refersh every 3600 sec
cal `date -v -1m "+%m %Y"`
@palaniraja
palaniraja / fuelprice.rss.output.txt
Last active Jan 21, 2018
Chennai - Fuel price - 2017-06-30 - 2018-01-21
View fuelprice.rss.output.txt
/**
* Notes:
* - First line price
* - Second line date
* - Price of both Petrol & Diesel for the day. Higher amount is Petrol price.
*
* Data were taken from: https://www.iocl.com/TotalProductList.aspx, it offers only limited history.
*/
Chennai Petrol Price today - 74.75 Chennai Petrol Price today - 74.75 -- Delivered by Feed43 service
@palaniraja
palaniraja / nas-setup.sh
Created Dec 16, 2017
Raspberry pi - NAS setup
View nas-setup.sh
# https://www.tinkernut.com/portfolio/make-raspberry-pi-nas-network-attached-storage/
sudo apt-get update
sudo apt-get install ntfs-3g
sudo apt-get update
sudo mkdir /media/NASDrive
You can’t perform that action at this time.