Skip to content

Instantly share code, notes, and snippets.

Dipesh Acharya xtranophilist

Block or report user

Report or block xtranophilist

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@xtranophilist
xtranophilist / TAOUP_13
Last active Aug 29, 2015
Quotes about FOSS, Programming, Software Design and Technology.
View TAOUP_13
Rule of Repair: When you must fail, fail noisily and as soon as possible.
-ESR
@xtranophilist
xtranophilist / pre-commit.py
Last active Aug 29, 2015 — forked from ptone/gist:4102528
Git pre-commit hook for Python
View pre-commit.py
#!/usr/bin/env python
import glob
import os
import sys
# git usurbs your bin path for hooks and will always run system python
site_packages = glob.glob('%s/lib/*/site-packages' % os.environ['VIRTUAL_ENV'])[0]
sys.path.insert(0, site_packages)
@xtranophilist
xtranophilist / 10-synaptics.conf
Last active Oct 12, 2015
My Synaptics Touchpad Configuration for Xorg
View 10-synaptics.conf
#vi /etc/X11/xorg.conf.d/10-synaptics.conf
#Supports Horizontal and Vertical Edge Scrolling, Two Finger Right click (tested on Dell XPS)
Section "InputClass"
Identifier "touchpad"
Driver "synaptics"
MatchIsTouchpad "on"
Option "TapButton1" "1"
Option "TapButton2" "3"
Option "VertEdgeScroll" "on"
Option "HorizEdgeScroll" "on"
@xtranophilist
xtranophilist / natgeo_pic_of_the_day.sh National Geographic Picture-Of-The-Day Wallpaper Script
View natgeo_pic_of_the_day.sh
#!/bin/bash
# Copyright (c) 2011 Josh Schreuder
# http://www.postteenageliving.com
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@xtranophilist
xtranophilist / ifappexists_tag.py
Last active Dec 23, 2015
Conditional Django template tag to check if one or more apps exist. Usage: {% ifappexists tag %} ... {% endifappexists %}, or {% ifappexists tag inventory %} ... {% else %} ... {% endifappexists %}
View ifappexists_tag.py
from django.template import Library
from django import template
from app import settings
register = Library()
@register.tag
def ifappexists(parser, token):
""" Conditional Django template tag to check if one or more apps exist.
@xtranophilist
xtranophilist / demo_centos.md
Last active Dec 30, 2015
DemocracyOS on Centos
View demo_centos.md

This is a manual for installing DemocracyOS app in CentOS.

Setting up the Requirements

  1. MongoDB =========== Installing MongoDB and starting its daemon:
View sublime-text-3-x32.sh
#!/bin/sh
if [ ! -f sublime_text_3.tar.bz2 ]; then
curl -L "http://c758482.r82.cf2.rackcdn.com/sublime_text_3_build_3083_x32.tar.bz2" -o "sublime_text_3.tar.bz2"
fi
tar -xvjf sublime_text_3.tar.bz2
sudo cp -fr "sublime_text_3/sublime_text.desktop" "/usr/share/applications/sublime_text.desktop"
sudo sed -i 's/Icon=sublime-text/Icon=\/opt\/sublime_text\/Icon\/128x128\/sublime-text.png/g' /usr/share/applications/sublime_text.desktop
rm -rf /opt/sublime_text
@xtranophilist
xtranophilist / ifusergroup_tag.py
Last active Jun 24, 2016
Django template tag to check to see if the currently logged in user belongs to one or more groups. Supports {% else %} block. Mod of http://djangosnippets.org/snippets/2736/ to support multi-word group names (with single/double quotes, e.g. {% ifusergroup 'Store Keeper' %}).
View ifusergroup_tag.py
from django import template
from django.template import resolve_variable, NodeList
from django.contrib.auth.models import Group
register = template.Library()
@register.tag()
def ifusergroup(parser, token):
""" Check to see if the currently logged in user belongs to one or more groups
@xtranophilist
xtranophilist / .zshrc
Last active Mar 3, 2017
My zsh aliases
View .zshrc
autoload colors
colors
PS1="%~ %{%(#~$fg[red]~$fg[blue])%}%#%{$fg[default]%} "
alias ..='cd ..'
alias autopep='autopep8 --in-place --aggressive --aggressive'
alias c2f='xclip -o -selection c'
alias ch='cd /var/www/html'
alias cl="clear; ls"
alias cpr="rsync --progress -ravz" #copy with progressbar
@xtranophilist
xtranophilist / imdb-getglue.js
Last active Apr 12, 2017
Opens up relative GetGlue Page for the current IMDB page
View imdb-getglue.js
slugify=function(str){
str = str.replace(/^\s+|\s+$/g, ''); // trim
str = str.toLowerCase();
// remove accents, swap ñ for n, etc
var from = "àáäâèéëêìíïîòóöôùúüûñç·/_,:;";
var to = "aaaaeeeeiiiioooouuuunc------";
for (var i=0, l=from.length ; i<l ; i++) {
str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i));
}
You can’t perform that action at this time.