Skip to content

Instantly share code, notes, and snippets.

View arpanpal010's full-sized avatar

Arpan Pal arpanpal010

View GitHub Profile
@arpanpal010
arpanpal010 / deduplicate.py
Last active October 28, 2015 06:30
Duplicate mover/remover based on file hashes.
#!/usr/bin/python
from __future__ import print_function
import sys, hashlib, os, shutil, time
from collections import Counter
#function to remove duplicates in folder by genrating and comparing their hash values
#has option to remove file automatically or move them to a separate place.
@arpanpal010
arpanpal010 / linkthedots.sh
Last active January 31, 2020 18:03
copy dot files from various locations to a single folder for backup.
#!/bin/bash
#script to copy the dotfiles to/from here to/from their proper places
#added file structure preservation - files are copied to their location related to root
#added logging errors
#to clone/sync my dotfiles: git clone https://github.com/arpanpal010/dotfiles.git
#Usage:
#$ sh linkthedots.sh collect --> get files
@arpanpal010
arpanpal010 / getter_media.sh
Last active October 28, 2015 06:18
script for gathering movie_ids, name_ids and character_ids from the mothership.
#!/bin/bash
#script for scraping movie IDs and name ids from IMDb. This script recusively crawls IMDb pages and extracts related movie/people/character ids and stores them in txt files.
#USAGE: -getid => gets movie ids into list_(imdb|name|character)_id.txt
# -getinfo=> gets data(XML/JSON/JSONP) and puts in store_data
# -print => prints current id/info status
#
#Added functionality to get data from omdbapi in JSON/XML format. Tweak custom URL according to need.
#Added functionality to get data from myapifilms in JSON/XML/JSONP format. Tweak custom URL according to need.
#CAUTION: DON'T RUN -getid and -getinfo together in same argument rather use separate windows!!
########################################################################
@arpanpal010
arpanpal010 / rpibackup.sh
Created July 20, 2014 05:22
Backup files from remote pc to a single location in storage (preserves relative paths).
#!/bin/bash
#this script backs up files from various locations in a remote computer.
#using scp to SFTP the files from remote.
#files are stored as they are to / in $backupdir (hierarchy preserved), either specify absolute path for backupdir, or use $rootdir as a container
#in future this script will be run as a cronjob
#have to provide password everytime, TODO setup keys (although this has nothing to do with the script)
#usage: files that are to be backed up from pi (mainly configs and server settings)
@arpanpal010
arpanpal010 / passgen.sh
Last active October 28, 2015 06:13
Simple password generator based on sha1 hashing and base64 encoding (require bash 4)
#!/bin/bash
#simple password geenrator based on sha1 hashing and base64 encoding.
#needs grep,read and sha1sum, base64
#written in bash 4.3.18
#
#added case-insensitivity in "INDEX"
#added master password hash generation
#added timing - clear screen after a time
#added hash based pasword checking (prompting for master password)
@arpanpal010
arpanpal010 / cryptmount.sh
Created July 29, 2014 05:50
wrapper for cryptsetup with LUKS.
#!/bin/bash
#script wrapper to create/(u)mount/resize encrypted non-root filesystems using cryptsetup + LUKS
#does NOT unmount automatically on shutdown.
#Truecrypt is insecure.
#more info: https://wiki.archlinux.org/index.php/Dm-crypt
#TODO
#move functions to own module function
#improve cli
@arpanpal010
arpanpal010 / about-rpi.md
Last active August 1, 2017 11:13
Raspberry Pi configurations

##Configurations for Raspberry Pi Home Server## #####Using Raspbian##### (although the procedures are similar/compatible with most debian based systems.)

###Added###

  • [sysctl.conf mods] (#file-sysctl-md)
  • [Firewall config] (#file-firewall-md)
  • [DNS Server] (#file-dns-md)
  • [Dynamic Dns] (#file-dyndns-md)
  • [Git Server] (#file-git-server-md)
@arpanpal010
arpanpal010 / gitlister.sh
Last active October 28, 2015 06:07
Script to find git repositories when it becomes bit hard to keep track of cloned/modifed repos.
#!/bin/bash
#script to find git repositories when it becomes hard to keep track of all git repositories
#takes $1 as root path to search, default= $PWD
# argumnet -diff checks if any of the gits are modified locally
# argumnet -url checks if any of the gits are modified locally
# both arguments are enabled by default so use -nodiff, -nourl
#read location or use current dir
@arpanpal010
arpanpal010 / gfeed2js.js
Created November 6, 2014 14:58
google feeds api parser in javascript. somewhat like feed2js but much simpler layout.
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
/*!-- Sample feedbox html --
<div class="feeds">
<p class="feed-title">
<a href="url">title</a>
description
</p>
<ul>
<li> entry </li>
@arpanpal010
arpanpal010 / multisearch.js
Created November 6, 2014 15:05
multisearch - search multiple website from a single searchbox using ;prefixes (used in my homepage)
<script type="text/javascript">
function fn_search() {
var leader= ';'; //this key determines its a search prefix
var searchForm=document.getElementById('searchForm');
var actionList=[ // match string prefix names, field names and default input required by search engines
//{ //template
// match_string: "",
// name: "",
// url: "",
// extra_inputs: [