Skip to content

Instantly share code, notes, and snippets.

@canabady
canabady / tn_pc_ac_listing.md
Last active January 1, 2021 01:40
TN PC AC listing

To get assembly_constituency,parliamentary_constituency as a listing of parliamentary_constituency with its assembly_constituencies below it, we can use VIM macro which does the job in a matter of seconds.

i.e

TO GET

Gummidipoondi (AC-1),Thiruvallur (PC-1)
Ponneri (AC-2),Thiruvallur (PC-1)
Thiruvallur (AC-4),Thiruvallur (PC-1)

Poonamallee (AC-5),Thiruvallur (PC-1)

@canabady
canabady / retrieve all pdf from a webpage
Last active April 1, 2020 09:46
To Retrieve all PDF anchor links from a webpage
# To retrieve All PDF anchors links from a web page
var pdflinks =[];
Array.prototype.map.call(document.querySelectorAll("a[href$=\".pdf\"]"), function(e, i){if((pdflinks||[]).indexOf(e.href)==-1){ pdflinks.push( "wget -O " + e.text.replace(/\s+$/, '').replace(/ /g,"_") + ".pdf " + e.href ); } });
console.log(pdflinks.join("\n"));
@canabady
canabady / gcrypt-remote
Last active January 10, 2020 06:51
Configure remote to perform gcrypt while pushing the commits to it
[remote "origin"]
url = "gcrypt::git@gitlab.com:ACCOUNT_NAME/personal.git#next"
fetch = +refs/heads/*:refs/remotes/gitcrypt/*
gcrypt-participants = 8DIGITKEY
@canabady
canabady / organizing myfiles.md
Last active January 3, 2020 10:11
organizing myfiles
<title>organizing myfiles</title>
@canabady
canabady / BGL-PDY-TJ-BGL-Trip.md
Last active December 27, 2019 12:43
BGL-PDY-TJ-BGL-Trip
<title>BGL-PDY-TJ-BGL-Trip</title>
#!/bin/bash
# DIR SETTINGS
_KURAL_DIR='/home/USERNAME/Music/Thirukkural/Kural-Song-Audio'
_PAADAL_DIR='/home/USERNAME/Music/01-Thevaram/00-thevaram-classified-by-artist'
# Scroll mail message based on isThevaram or isKural is true ( for auto scroll with xdotool )
typeset -g isThevaram=false
typeset -g isKural=false
# Every time an attempt to open an attachment is made, it's copied in a dedicated temp directory and the copy is opened.
# application/*; mkdir -p /tmp/mutt \; cp %s /tmp/mutt \; xdg-open /tmp/mutt/$(basename %s) &
##############################################################################
#
# MIME types and programs that process those types
#
###############################################################################
application/vnd.openxmlformats-officedocument.wordprocessingml.document; /usr/bin/abiword '%s'; test=test -n "$DISPLAY"
application/pdf; /usr/bin/xpdf -fullscreen '%s'; test=test -n "$DISPLAY"
set imap_user = "mailbox@gmail.com"
set imap_pass = ""
# set smtp_url = "smtp://mailbox@smtp.gmail.com:465/"
set smtp_url = "smtp://mailbox@gmail.com@smtp.gmail.com:587/"
set smtp_pass = ""
set from = "mailbox@gmail.com"
set realname = "Mailbox Name"
set folder = "imaps://imap.gmail.com:993"
set spoolfile = "+INBOX"
set postponed = "+[Gmail]/Drafts"
# Folder hooks
folder-hook 'mailbox.gmail.com' 'source ~/.mutt/muttrc/mailbox.gmail.com.muttrc'
# Default account
source ~/.mutt/muttrc/mailbox.gmail.com.muttrc
# set tmpdir="~/Temp/tmp"
# Macros for switching accounts
macro index <f2> '<sync-mailbox><enter-command>source ~/.mutt/muttrc/mailbox.gmail.com.muttrc<enter><change-folder>!<enter>'
@canabady
canabady / devtools.py
Created December 3, 2019 15:03 — forked from hellricer/devtools.py
ELinks hooks providing a framework for manipulating DOM
import os
import re
import subprocess
from bs4 import BeautifulSoup
import rules
def replacer(url, html):
new = html
reload(rules)