Skip to content

Instantly share code, notes, and snippets.

View aniruddha-adhikary's full-sized avatar

Aniruddha Adhikary (Ani) aniruddha-adhikary

View GitHub Profile
@aniruddha-adhikary
aniruddha-adhikary / bing.php
Created July 29, 2012 09:40
Bing Wallpaper Fetcher
<?php
system("wget -q http://www.bing.com -O bing");
$dump = file_get_contents("bing");
system("rm bing");
$chunks = explode("g_img=", $dump);
$temps = explode("'", $chunks[1]);
$url = "http://www.bing.com/".$temps[1];
system ("wget -q $url -O /home/".'$USER'."/Pictures/bing.jpg");
system ("gsettings set org.gnome.desktop.background picture-uri file:///home/".'$USER'."/Pictures/bing.jpg");
?>
@aniruddha-adhikary
aniruddha-adhikary / views.py
Created March 27, 2013 18:51
Fixed Request Context
from django.shortcuts import render_to_response
from django.template import RequestContext
def about(request):
return render_to_response("about.html",
{'page_title': 'About us',
#and other stuff
},
RequestContext(request))
@aniruddha-adhikary
aniruddha-adhikary / quran_scraper.py
Last active December 19, 2015 06:59
A scraper for collecting all surahs of the Quran into JSON files using BeautifulSoup.
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import urllib2
from BeautifulSoup import BeautifulSoup
def main():
linkslist = getAyahLinks()
sura_count = 0
for each_link in linkslist:
@aniruddha-adhikary
aniruddha-adhikary / colors.js
Last active December 22, 2015 22:39
random colors on page like apple :3
var colors = ["#27ae60", "#3498db", "#9b59b6", "#34495e", "#d35400", "#D35400"]; //le flatui colors
var randomInt = function(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
};
$(document).ready(function(){
var colorint = randomInt(0,5);
$("body").css("background-color", colors[colorint]);
$(".btn-home-menu").css("color", colors[colorint]);
@aniruddha-adhikary
aniruddha-adhikary / ubuntu-release-checker.py
Last active March 21, 2016 16:45
ubuntu release checker
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib
import json
version = "15.10"
arch = "i386" # i386 or amd64
mirrorlist = ["http://ubuntu.mirror.mendoza-conicet.gob.ar/", "http://releases.ubuntu.unc.edu.ar/", "http://ftp.iinet.net.au/pub/ubuntu-releases/", "http://mirror.aarnet.edu.au/pub/ubuntu/releases/", "http://mirror.netspace.net.au/pub/ubuntu-releases/", "http://ubuntu.mirror.serversaustralia.com.au/ubuntu-releases/", "http://ubuntu.mirror.uber.com.au/releases/", "http://mirror.internode.on.net/pub/ubuntu/releases/", "http://ubuntu.lagis.at/releases/", "http://mirrors.ispros.com.bd/ubuntu-release/", "http://by.releases.ubuntu.com/", "http://ubuntu-releases.mirror.nucleus.be/", "http://ubuntu.mirrors.skynet.be/pub/ubuntu.com/releases/", "http://bw.releases.ubuntu.com/", "http://ubuntu.c3sl.ufpr.br/releases/", "http://mirror.globo.com/ubuntu/releases/", "http://mirror.pop-sc.rnp.br/mirror/ubuntu/", "http://ubuntu.mirror.pop-sc.rnp.br/mirror/ubuntu-releases/", "http://mirror.unesp.br/ubuntu
@aniruddha-adhikary
aniruddha-adhikary / eduboard.py
Created December 2, 2013 07:46
Education Board Result Scraper
import urllib2
from BeautifulSoup import BeautifulSoup
def get_html(exam, year, board, roll):
"""Get the result page HTML output directly.
get_html(exam, year, board, roll)"""
base_url = "http://www.educationboardresults.gov.bd/regular"
base_index = 'index.php'
#include <linux/string.h>
#include "lcm_drv.h"
static LCM_UTIL_FUNCS lcm_util = {0};
#define SET_RESET_PIN(v) (lcm_util.set_reset_pin((v)))
#define UDELAY(n) (lcm_util.udelay(n))
#define MDELAY(n) (lcm_util.mdelay(n))
@aniruddha-adhikary
aniruddha-adhikary / BanglaEncodingConverter.py
Created May 10, 2014 20:17
Prototype of Base Converter
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
class BanglaEncodingConverter:
"""Converts Bengali Text between Encodings"""
def replace(self, source, target, in_text):
"""Returns a string encoded to target_encoding from source_encoding.
@aniruddha-adhikary
aniruddha-adhikary / gist:e58fedf6501de01f93f8
Created July 17, 2014 07:31
Proxying callback server in Bottle.py
#!/usr/bin/env python
from bottle import request, run, route, template, static_file
@route('/box/auth')
def authorize_box():
code = request.query.code;
if(code):
return template("""
@aniruddha-adhikary
aniruddha-adhikary / fb_image_downloader.py
Created April 5, 2015 06:41
Download all images from Facebook Profiles / Pages
#!/usr/bin/env python
import urllib2
import json
import os
from datetime import datetime
import re
params = {