Skip to content

Instantly share code, notes, and snippets.

View prakhar1989's full-sized avatar
I may be slow to respond.

Prakhar Srivastav prakhar1989

I may be slow to respond.
View GitHub Profile
@prakhar1989
prakhar1989 / 4clojure.md
Last active August 29, 2015 14:12
Tracking closure of Clojure
@prakhar1989
prakhar1989 / Flask on Centos.md
Created December 24, 2014 12:27
Deploying Flask on Centos

Nginx Configuration

server {
	listen 81; # make this 81
  charset utf-8;

	server_name easycredit.xcite.com;
	root /var/www/enet;
@prakhar1989
prakhar1989 / python-centos.md
Last active August 29, 2015 14:12
Python on CentOS
# installing dependencies 
yum install python-pip
sudo pip install virtualenv

# setup python2.7 
yum install python27
virtualenv -p /usr/bin/python2.7 venv

# required for mysql
@prakhar1989
prakhar1989 / classcentral.md
Last active August 29, 2015 14:11
ClassCentral Widget

Meetup.com

  • Uses a iframe to render the content. Can use explicit width and height settings to render the way we want (can be configurable as well)
  • The good thing is that iframe acts as a sandbox and we can load external js e.g. backbone / jquery which will definitely ease the development.
<!-- iframe generated -->
<iframe width="225" height="570" src="http://meetu.ps/2F9WG8" frameborder="0"></iframe>
<iframe width="650" height="300" src="http://meetu.ps/2F9XJy" frameborder="0"></iframe>
@prakhar1989
prakhar1989 / ipstats.sh
Created October 19, 2014 14:01
IP Stats
#!/bin/bash
logfile=/var/log/nginx/site-access.log
count=20
if [ "$1" != "" ];
then
echo "Data for file: $logfile with filter: $1"
grep $1 $logfile | awk '{print $1}' | sort | uniq -c | sort -nk1 -r | head -n $count
else
@prakhar1989
prakhar1989 / site.md
Created October 1, 2014 07:10
generated site
prakhar1989.github.com git/master*
❯ tree _site  | pbcopy

_site
├── 404.html
├── CNAME
├── Gemfile
├── Gemfile.lock
├── LICENSE
@prakhar1989
prakhar1989 / mallya.css
Created September 30, 2014 23:05
Mallya.css
/*
Changes:
1. Best to stick to one unit of measurement either em or px.
2. Use max-widths so that you can make your content responsive.
3. If you use margin: a b, then top and bottom get a and right left get b. Leads to cleaner rules
4. a(:not)(:hover) is not recommended (cross-browser issues) instead use two rules for a and a:hover
*/
body {
font-family: "Helvetica Neue", Helvetica, sans-serif;
margin: 40px auto;
@prakhar1989
prakhar1989 / 24_game.rs
Created September 13, 2014 17:26
24 Game
// Implements http://rosettacode.org/wiki/24_game
// Uses RPN expression
use std::io;
use std::rand::{task_rng, Rng};
#[cfg(not(test))]
fn main() {
// generating 4 numbers
let mut rng = task_rng();
@prakhar1989
prakhar1989 / build.xml
Created September 9, 2014 14:15
Build
<?xml version="1.0"?>
<project name="orange" description="Project Orange build file" default="help">
<property name="modules_dir" value="/" />
<property name="source.code" value="app/code/" />
<property name="source.design" value="app/design/" />
<property name="source.js" value="js/" />
<property name="source.skin" value="skin/" />
<property name="source.etc" value="app/etc/" />
<property name="source.holding" value="holding/" />
<property name="source.lib" value="lib/" />
{
"crosswordId": "sdhbfsdlbvshv",
"packId": "sdkcdjsknckjdsn",
"gridSize": 10,
"backgroundColor": "#FF000000",
"cellNormalColor": "#FFFFFFFF",
"cellSelectedColor": "#FF123456",
"across": [
{
"clueId": "dfkfvfjk",