Skip to content

Instantly share code, notes, and snippets.

View arpanpal010's full-sized avatar

Arpan Pal arpanpal010

View GitHub Profile
@arpanpal010
arpanpal010 / chatbox.py
Created February 4, 2015 14:15
minimal text based bulletin board using http.server, single threaded, auto refreshes. exactly 100 loc.
from __future__ import print_function #from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
import http.server, urllib, datetime
#=================================================================
sUrl="/chatbox" #server url
port=8080 #server port
timedRefresh="15" #time before page refreshes
msgBox=[] #messages held here as dict objects
#=================================================================
# create html
#=================================================================
@arpanpal010
arpanpal010 / all-in-one.html
Created January 20, 2015 16:00
HTML/CSS/JS Minimal Template
<!doctype html>
<html>
<!--
TODO:
----
write things to do here
-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
@arpanpal010
arpanpal010 / tbkp.sh
Created January 8, 2015 14:46
Tar based backup script. Provides options to select snapshot (when backing up) or restore points (when restoring)
#!/bin/bash
# backup script for incremental backups
tbkp () {
[[ -z "$1" ]] && ( echo "Usage:";
echo "tbkp /path/to/dir/"; return 1; )
fp="$(readlink -f "$1")"; #full path of dir to be used
if [ -d "$fp" ]; then
lc="${fp%/*}"; #absolute location to be removed from tar
@arpanpal010
arpanpal010 / .gitconfig
Last active August 29, 2015 14:12 — forked from pksunkara/config
[user]
name = Pavan Kumar Sunkara
email = pavan.sss1991@gmail.com
[core]
editor = vim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
excludesfile = ~/.gitignore
[sendemail]
smtpencryption = tls
smtpserver = smtp.gmail.com
@arpanpal010
arpanpal010 / tempmon.sh
Created November 6, 2014 15:13
Simple CPU temperature monitor, also displays core speeds if available. Requires manual setting of temperature sources
#tempmon modified
function tempmon() {
# datadir="$HOME/tempinfo";
datadir="/tmp/tempinfo";
# rm -rf $datadir;
mkdir -p $datadir;
sleeptime=10; #seconds
@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: [
@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 / 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 / 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 / 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