Skip to content

Instantly share code, notes, and snippets.

View aniruddha-adhikary's full-sized avatar

Aniruddha Adhikary (Ani) aniruddha-adhikary

View GitHub Profile
#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 / 0001-telephony-add-mediatek-mt65x2-support.patch
Created May 26, 2015 03:46
mediatek mt65x2 dual SIM RIL support patch for frameworks/opt/telephony
From fcb7e94b6c0adf7427326aa50e7f8a9267b1e5f6 Mon Sep 17 00:00:00 2001
From: Aniruddha Adhikary <aniruddha@adhikary.net>
Date: Tue, 26 May 2015 09:36:42 +0600
Subject: [PATCH 1/1] telephony: add mediatek mt65x2 support
Change-Id: I8866ca89bb933bc1e57e5316c8579cf7b23294cb
---
src/java/com/android/internal/telephony/RIL.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@aniruddha-adhikary
aniruddha-adhikary / my_cool_api.py
Created July 6, 2015 18:25
mini api server in python and bottle
from bottle import run, route
import json
list_of_movies = ['The King of Pythons', "The Lord of the Horns"]
@route('/movies')
def get_movies():
return json.dumps(list_of_movies)
run(host='localhost', port=8080)
@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 / 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'