Skip to content

Instantly share code, notes, and snippets.

View voidabhi's full-sized avatar

Abhijeet Mohan voidabhi

View GitHub Profile
@voidabhi
voidabhi / base.css
Last active August 29, 2015 14:28 — forked from planetoftheweb/base.css
Base CSS document with google fonts, Eric Meyer's reset.css, Ethan Schoonover's solarized palette and some basic responsive code.
@import url(http://fonts.googleapis.com/css?family=Roboto+Slab:700|Exo+2:300,600);
/* Eric Meyer's Reset CSS v2.0 - http://cssreset.com */
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{border:0;font-size:100%;font:inherit;vertical-align:baseline;margin:0;padding:0}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:none}table{border-collapse:collapse;border-spacing:0}
/* Solarized Palette - http://ethanschoonover.com/solarized ---------
lightgray : #819090;
gray : #70
var debug = true;
var log = function(type){ debug && window.console && console[( type in console ? type : 'log' )].apply(console, Array.prototype.slice.call(arguments, ( type in console ? 1 : 0 ))); };
@voidabhi
voidabhi / slack-snippets.py
Created February 14, 2016 22:58
Slack snippets in python
def post_message(token, channel, text, username):
'''
Sending a message(text) as username to channel
'''
params = {
"token": token,
"channel": channel,
"text": text,
"username": username,
@voidabhi
voidabhi / node-sample-commandline.js
Last active February 15, 2016 13:23
Simple command line utility in node
var fs = require('fs');
function parseArg(opt) {
var args = Array.prototype.slice.call(process.argv, 2);
var matches = args.filter(function(arg) {
return arg.indexOf(opt) > -1;
});
if (Array.isArray(matches) && matches.length) {
@voidabhi
voidabhi / ConsoleLogger.php
Last active February 16, 2016 08:00
Php Logging
<?php
namespace Logging;
use Psr\Log\AbstractLogger;
/**
* Class ConsoleLogger
*
* @package Thruway
@voidabhi
voidabhi / checkconfig.sh
Created February 18, 2016 12:04
Basic checkconfig commands
#!/bin/bash
# list all services
chkconfig --list
# check status of specific service
chkconfig --list | grep httpd
# start perticular service on run levels
chkconfig --level 35 httpd on
@voidabhi
voidabhi / stdio.py
Created February 19, 2016 07:04
Python utility for writing to standard output
# coding=UTF-8
"""
@example
from stdio import stdio
stdio.write('hello world')
data = stdio.read()
print stdio.STDIN_FILENO
print stdio.STDOUT_FILENO
"""
import thread
@voidabhi
voidabhi / benchmark.py
Last active February 19, 2016 15:40
Benchmarking for python functions
import time
def print_numbers(n):
for i in xrange(n):
pass
class BM(object):
@voidabhi
voidabhi / helpers.go
Created June 26, 2016 22:25
Golang helpers
// GetBytes accepts any object (interface{]}) and returns its json encoded byte array
func GetBytes(key interface{}) ([]byte) {
var buf bytes.Buffer
enc := json.NewEncoder(&buf)
err := enc.Encode(key)
if err != nil {
return []byte("")
}
return buf.Bytes()