Skip to content

Instantly share code, notes, and snippets.

View jerinphilip's full-sized avatar
🏡

Jerin Philip jerinphilip

🏡
View GitHub Profile
@jerinphilip
jerinphilip / cpp11.cpp
Last active August 29, 2015 14:21
C++ 11
//static initialization of containers
vector <int> V = {1, 2, 3};
pair <int, int> p = {1, 2};
map <int, string> M = {
{0, "Hello"},
{1, "World"}
};
//Type inference
@jerinphilip
jerinphilip / BIT.cpp
Created June 23, 2015 08:04
Implementation of Binary Indexed Tree
class BIT{
int T[MAX], size;
public:
BIT(int n){
size = n;
for(int i=1; i<=n; i++)
T[size] = 0;
}
int get(int i){
#include <iostream>
using namespace std;
struct sudoku{
int A[9][9];
bool FIXED[9][9];
bool check_row(int x, int i, int j){
//For a row, i=const
if [ -d /etc/X11/xinit/xinitrc.d ] ; then
for f in /etc/X11/xinit/xinitrc.d/?* ; do
[ -x "$f" ] && . "$f"
done
unset f
fi
xrdb -merge ~/.Xresources #To merge settings
nm-applet &> /dev/null & #NetworkManager
xscreensaver -no-splash & #Screensaver
xcompmgr -c -C -t-5 -l-5 -r4.2 -o.55 & #Compositing
@jerinphilip
jerinphilip / dtella_install.sh
Created September 1, 2015 14:01
Install Instructions fo dtella for ArchLinux
pacman -S python2-{twisted,crypto,dnspython,gdata}
git clone https://github.com/ffledgling/dtella.git
cd dtella
sed '1,1s/python/python2/' -i dtella.py
./dtella.py
@jerinphilip
jerinphilip / rc.lua.diff
Created September 5, 2015 15:50
Wallpaper cycling.
diff --git a/awesome/rc.lua b/awesome/rc.lua
index 7587d6b..7d2d3a2 100644
--- a/awesome/rc.lua
+++ b/awesome/rc.lua
@@ -560,3 +560,32 @@ end
battery_timer = timer({timeout=100})
battery_timer:connect_signal("timeout", function() check_battery() end)
battery_timer:start()
+
+
@jerinphilip
jerinphilip / dtella_debian_based.sh
Created September 19, 2015 13:00
Dtella Install - System Level
sudo apt-get install python-pip
pip install -v twisted PyCrypto dnspython gdata
git clone https://github.com/ffledgling/dtella.git
cd dtella
./dtella.py
@jerinphilip
jerinphilip / fetch.py
Created October 1, 2015 13:00
WhatsApp Inc. IP addresses
import lxml.html
import requests
import re, operator
def extract_page_ips(response):
tree = lxml.html.fromstring(response.text)
content = tree.xpath('//div[@id="border-wrapper"]')[0]
expr = re.compile("/ip/[0-9.]*")
hrefs = map(lambda x: x[2], content.iterlinks())
ip_links = filter(expr.match, hrefs)
@jerinphilip
jerinphilip / allthelinks.js
Created January 30, 2016 06:50
Filter out Useful Links.
@jerinphilip
jerinphilip / font_conf.xml
Created February 27, 2016 08:23
Snippet to match helvetica to a desired font
<!-- Add the below rule to /etc/fonts/fonts.conf or ~/.fonts.conf -->
<match target="pattern">
<test qual="any" name="family"><string>helvetica</string></test>
<edit name="family" mode="assign" binding="same"><string>Open Sans</string></edit>
</match>