Skip to content

Instantly share code, notes, and snippets.

View anirudh-ramesh's full-sized avatar
🏁
pongal-o-pongal

Anirudh Ramesh anirudh-ramesh

🏁
pongal-o-pongal
View GitHub Profile
#!/bin/bash
# This scripts pops up a notification in X if your RAM is occupied more
# than a certain value (default: 90%).
# Memory is checked every 30 seconds.
checkmemory () {
while
sleep 30
FREE=`free -tw | grep Mem | tr -s ' ' | cut -d ' ' -f 4`
USED=`free -tw | grep Mem | tr -s ' ' | cut -d ' ' -f 3`
@anirudh-ramesh
anirudh-ramesh / select.sh
Created March 18, 2017 14:58 — forked from vikjam/select.sh
Use awk to subset a CSV
# http://stackoverflow.com/questions/6491532/how-to-subset-a-file-select-a-numbers-of-rows-or-columns
cat largefile | awk 'NR >= 10000 && NR <= 100000 { print }'
@anirudh-ramesh
anirudh-ramesh / trashcan.log
Created October 28, 2017 19:08
Writers' Tips
The first draft is for the writer. The second draft is for the editor. The last draft is for the reader.
Emphasize how much work you have ahead of you to make this a good book.
Only a good writer would be able to say that.
If you would only defer to the narrative, you could get away with murder.
Most mysterious of all is the hidden middle stage, the offstage act of editing.
The first draft is for the writer. The second draft is for the editor. The last draft is for the reader.
Move a group of components around a schematic:
move (>0 0) (0 -0.5);
Generate statistics of a board:
run length-freq-ri
Smash all & Change the typeface, ratio, and size of all elements:
group all; smash (> 0 0); change font vector (>0 0); change ratio 8 (>0 0); change size 0.07 (>0 0);
@anirudh-ramesh
anirudh-ramesh / rename_serialize.sh
Last active October 4, 2019 09:59
Library of Shell scripts
ls -v | cat -n | while read n f; do mv -n "$f" "$n.png"; convert "$n.png" "$n.pdf"; done
@anirudh-ramesh
anirudh-ramesh / readCookies.py
Created September 29, 2019 17:09
Read Cookies
#!/usr/bin/env python
import os
import sqlite3
import pwd
_cookieName = "preferredLanguage"
def getPreferredLanguageFromCookieDB():
retval="en-US"
cookieDBFilename = os.path.join(pwd.getpwuid(1000).pw_dir, ".config/google-chrome/Default/Cookies")
@anirudh-ramesh
anirudh-ramesh / winbattery.py
Created November 16, 2020 16:55
Win Battery using WMI
import wmi
c = wmi.WMI()
t = wmi.WMI(moniker = "//./root/wmi")
batts1 = c.CIM_Battery(Caption = 'Portable Battery')
for i, b in enumerate(batts1):
print 'Battery %d Design Capacity: %d mWh' % (i, b.DesignCapacity or 0)
@anirudh-ramesh
anirudh-ramesh / Node-RED_file_upload.json
Created June 19, 2021 11:39 — forked from natcl/Node-RED_file_upload.json
Node-RED file upload example with built-in http in node.
[
{
"id": "f1ffeb7e.f6451",
"type": "http in",
"z": "c29865fe.249648",
"name": "",
"url": "/upload",
"method": "get",
"upload": false,
"swaggerDoc": "",
@anirudh-ramesh
anirudh-ramesh / clean__journal.sh
Last active March 14, 2023 09:56
Clean Snap packages
# journalctl --disk-usage
journalctl --vacuum-size=50M
journalctl --vacuum-time=10d
echo SystemMaxUse=500M | tee -a /etc/systemd/journald.conf
@anirudh-ramesh
anirudh-ramesh / _backup_restore.sql
Last active July 9, 2023 05:54
Clean Irasus data
SET statement_timeout TO 1200000;
--
\COPY (SELECT * FROM "traccar"."tc_devices" ORDER BY "id" ASC) TO '/goodenough_0/devices.csv' WITH CSV DELIMITER ',' HEADER QUOTE '"' ESCAPE '''';
\COPY (SELECT * FROM "traccar"."tc_users" ORDER BY "id" ASC) TO '/goodenough_0/users.csv' WITH CSV DELIMITER ',' HEADER QUOTE '"' ESCAPE '''';
\COPY (SELECT * FROM "traccar"."tc_positions" ORDER BY "id" ASC) TO '/goodenough_0/positions.csv' WITH CSV DELIMITER ',' HEADER QUOTE '"' ESCAPE '''';
--