Skip to content

Instantly share code, notes, and snippets.

Amitesh Kumar Amitesh

Block or report user

Report or block Amitesh

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
View sublime-text3-users-keybindings
[
{ "keys": ["alt+d"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Line.sublime-macro"} },
{ "keys": ["alt+w"], "command": "toggle_setting", "args": {"setting": "word_wrap"} },
{ "keys": ["ctrl+b"], "command": "toggle_side_bar" }
]
@Amitesh
Amitesh / sublime-text3-plugin-list
Last active May 2, 2017
My Choice of Sublime text 3 plugin list
View sublime-text3-plugin-list
Alignment
Terminal
DocBlocker
Emmet
trimmer
csscomb
Color Highlighter
jsFormat
plainTask
AllAutocomplete
@Amitesh
Amitesh / linear-congruential-generator.js
Created Sep 30, 2015
A linear congruential generator (LCG) is an algorithm that yields a sequence of pseudo-randomized numbers calculated with a discontinuous piecewise linear equation.
View linear-congruential-generator.js
/**
* Linear Congruential Generator
* http://en.wikipedia.org/wiki/Linear_congruential_generator
*/
function RandomNumberGeneratorFn($log) {
'use strict';
$log = $log || console;
@Amitesh
Amitesh / table.css
Last active Aug 29, 2015
Table Sorting, Filtering - Fixed the empty cell filtering issue http://www.javascripttoolbox.com/lib/table/index.php
View table.css
/* Striping */
tr.alternate {
background-color:#ffffcc;
}
/* Sorting */
th.table-sortable {
cursor:pointer;
background-position:center left;
background-repeat:no-repeat;
@Amitesh
Amitesh / color-console-messages.js
Last active Aug 29, 2015
Color console messages in chrome and firefox
View color-console-messages.js
console.log('%cHello world', 'font-size:100px;color:#fff;text-shadow:0 1px 0 #ccc,0 2px 0 #c9c9c9,0 3px 0 #bbb,0 4px 0 #b9b9b9,0 5px 0 #aaa,0 6px 1px rgba(0,0,0,.1),0 0 5px rgba(0,0,0,.1),0 1px 3px rgba(0,0,0,.3),0 3px 5px rgba(0,0,0,.2),0 5px 10px rgba(0,0,0,.25),0 10px 10px rgba(0,0,0,.2),0 20px 20px rgba(0,0,0,.15);');
@Amitesh
Amitesh / click-toggle.js
Created May 6, 2015
Click Toggle jQuery Plugin
View click-toggle.js
(function($) {
$.fn.clickToggle = function(func1, func2) {
var funcs = [func1, func2];
this.data('toggleclicked', 0);
this.click(function() {
var data = $(this).data();
var tc = data.toggleclicked;
$.proxy(funcs[tc], this)();
data.toggleclicked = (tc + 1) % 2;
});
@Amitesh
Amitesh / question_render.js
Created Apr 20, 2015
sample-code-snippets
View question_render.js
/**
* Module for QHash Application
* @author : Amitesh Kumar
*
*/
window.QHash = window.QHash || {};
( function ( QHash ) {
/**
* Answer Model
@Amitesh
Amitesh / gist:5719948
Created Jun 6, 2013
Add new device to eclipse for android development
View gist:5719948
sudo vi /etc/udev/rules.d/99-android.rules
http://developer.android.com/tools/device.html
http://www.reactivated.net/writing_udev_rules.html
http://eagle.phys.utk.edu/guidry/android/installOnDevice.html
@Amitesh
Amitesh / gist:5027713
Created Feb 25, 2013
kill all connection to db and drop postgresql db
View gist:5027713
Query pg_stat_activity and get the pid values you want to kill and issue select pg_terminate_backend(pid int) to them.
PostgreSQL 9.1 and below:
SELECT pg_terminate_backend(pg_stat_activity.procpid)
FROM pg_stat_activity
WHERE pg_stat_activity.datname = 'mydb_prod_jan';
PostgreSQL 9.2 and above:
@Amitesh
Amitesh / gist:3385033
Created Aug 18, 2012
Apache cron watch
View gist:3385033
#apache-cron-watcher.sh
#!/bin/sh
run=`ps ax | grep /usr/sbin/apache2 | grep -v grep | cut -c1-5 | paste -s -`
if [ "$run" ];
then
echo “Apache is running”
else
echo "Apache not running"
/etc/init.d/apache2 restart
You can’t perform that action at this time.