Skip to content

Instantly share code, notes, and snippets.

View palaniraja's full-sized avatar

palaniraja palaniraja

View GitHub Profile
@palaniraja
palaniraja / auto-shutdown.sh
Last active September 9, 2023 19:45
auto-shutdown on higher temprature for raspberrypi - kill kodi & fbi along - copied from raspberrypi forum
#!/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 May 7, 2023 17:49
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
#!/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 June 14, 2018 14:24
My Canon SLR lens - optics info from lensfun
<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 June 11, 2018 16:47
Raspberry Pi - Automount - usb drives using usbmount - and share drives via samba

Installation of packages

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

Setup Samba

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 16:20
Medium blog - Declutter bookmarklet
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 02:36
image magick - image diff in batches
# 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 November 1, 2022 21:29
Geek tool scripts I use with my desktop
# 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 January 21, 2018 10:18
Chennai - Fuel price - 2017-06-30 - 2018-01-21
/**
* 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 December 16, 2017 14:37
Raspberry pi - NAS setup
# 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