Skip to content

Instantly share code, notes, and snippets.

View napsternxg's full-sized avatar
🎯
Focusing

Shubhanshu Mishra napsternxg

🎯
Focusing
View GitHub Profile
@napsternxg
napsternxg / quineWindows.c
Created October 28, 2012 06:39
Smallest Quine in Windows which works with diff command
main(){char *s="main(){char *s=%c%s%c;printf(s,34,s,34, 13,10);}%c%c";printf(s,34,s,34, 13, 10);}
@napsternxg
napsternxg / pearl_1_liners.pl
Created October 31, 2012 10:51
Pearl 1 liners
=for comment
Useful One-Line Scripts for Perl Jan 28 2012 | version 1.08
-------------------------------- ----------- ------------
Compiled by Peteris Krumins (peter@catonmat.net, @pkrumins on Twitter)
http://www.catonmat.net -- good coders code, great reuse
Latest version of this file is always at:
@napsternxg
napsternxg / listFolderAndSize.sh
Created November 23, 2012 05:04
List the size of all folders in directory path
du -k | sort -nr | more #Returns the answer in KBs
du -sh /* #returns in a more human readable form
s/__(\/.*)__/[[Anchor\(\1\)]]\n__\1__/g
s/\*\ \[\#(.*)\]/\*\ \[\#\1 label \1]/g
s/\*\ (.*)/\*\ \[\#\1\]/g
@napsternxg
napsternxg / flipkart-republic-day-doodle.js
Last active December 11, 2015 19:39
Javascript for Flipkart's republic day, 2013 doodle.
var doodle = (function () {
Function.prototype.bind = Function.prototype.bind || function (u) {
var v = this;
return function () {
return v.apply(u, arguments)
}
};
var g = false;
var a = function (u) {
g && console && console.log && console.log(u)
@napsternxg
napsternxg / enableX11Plot.R
Created January 30, 2013 09:28
Configurations for R for drawing plots on Fedora 18. Taken from: https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=15168
X11.options(type="xlib")
@napsternxg
napsternxg / clearRaidData.sh
Created January 30, 2013 09:33
Use this command to allow Fedora 18 installer to detect RAID enabled HDDs on Hybrid Drive based machines like HP Envy ultrabooks.
su
dmraid -r -E
#Will prompt for each device listed on the machine.
#Answer y for all or for the ones which you want to be detected by Linux installer.
@napsternxg
napsternxg / sortedListTar.sh
Created February 11, 2013 11:23
List files in tar file in sorted order of modified date.
tar -tvf file.tar.gz | sort -k 6,8
@napsternxg
napsternxg / checkVarPresence.sh
Created February 13, 2013 16:37
Check for presence of variables in a string. Like help="This is a string containing a $VARIABLE in it" The script will echo TRUE using regex match.
if [[ "$help" =~ (\$[A-Za-z0-9]*) ]]; then echo "TRUE"; else echo "FALSE"; fi
@napsternxg
napsternxg / p4Opened-ls.sh
Created February 19, 2013 12:40
Opened files with time of change using p4 opened with the path as per your client.
p4 opened | sed 's/.*usr\.src\/\(.*\)#.*/\1/g'| xargs -I {} ls -lh {};