Skip to content

Instantly share code, notes, and snippets.

View 0i0's full-sized avatar
💭
Good times

Léo Hakim 0i0

💭
Good times
View GitHub Profile
cat *.csv > combined.csv
cat combined.csv | awk '!a[$0]++' > c-no-dups.csv
python sort.py
cat c-no-dups-sorted.csv | tail -n 350 > topsort350.csv
cat topsort350.csv | awk -F, '{print "https://raw.githubusercontent.com/"substr($2,0,length($2))"/master/README.md"}' > readme.links
python downloadraw.py
@0i0
0i0 / geektool
Last active October 4, 2017 15:58
get top processes
ps -Ao pid,%cpu,%mem,comm |sort -nrk 2 | head -n 5 | awk '{gsub("(.+/)","",$4);print $4"\t"$1"\t"$2"\t"$3}'| column -t
xrandr --output DP-1 --scale 2x2.001 --panning 3840x2161+3840+0
xrandr --output DP-1 --scale 2x2.001 --mode 1920x1080 --fb 7680x2162 --panning 3840x2162+3840+0
@0i0
0i0 / .bash_profile
Created August 11, 2013 23:33
Ahoy greeting
echo -e "\x1b[36m ______ __ __ ______ __ __ __ "
echo -e "\x1b[32m/\x1b[36m\ __ \ \x1b[32m /\x1b[36m\ \_\ \ \x1b[32m /\x1b[36m\ __ \ \x1b[32m /\x1b[36m\ \_\ \ \x1b[32m /\x1b[36m\ \ "
echo -e "\x1b[32m\ \x1b[36m\ __ \ \x1b[32m \ \x1b[36m\ __ \ \x1b[32m \ \x1b[36m\ \\\\\x1b[32m/\x1b[36m\ \ \x1b[32m \ \x1b[36m\____ \ \x1b[32m \ \x1b[36m\_\ "
echo -e "\x1b[32m \ \x1b[36m\_\ \_\ \x1b[32m \ \x1b[36m\_\ \_\ \x1b[32m \ \x1b[36m\_____\ \x1b[32m \/\x1b[36m\_____\ \x1b[32m \/\x1b[36m\_\ "
echo -e "\x1b[32m \/_/\/_/ \/_/\/_/ \/_____/ \/_____/ \/_/ "
echo -e ""
@0i0
0i0 / ShortAjax.js
Created November 24, 2012 17:10
Short Ajax
var xhr = new XMLHttpRequest()
var url = 'http://'
xhr.open("GET",url,false)
xhr.setRequestHeader("Content-Type", "text/plain;charset=UTF-8")
xhr.send(null)
if (xhr.status==200){
var data = JSON.parse(xhr.responseText)
console.log(data)
} else {
@0i0
0i0 / tomorrow-night.css
Created July 12, 2012 01:27
Code mirror tomorrow night theme
.CodeMirror-scroll {
height: 100%;
min-height:300px;
}
.cm-s-tomorrow-night{
font-family:'Menlo', 'Consolas', "Vera Mono", monospace;
font-size:12px;
}
.cm-s-tomorrow-night { background: none; color: hsl(140,2%,77%); }
@0i0
0i0 / gist:1590079
Created January 10, 2012 17:16
color functions HSL RGB Hex
//http://www.codingforums.com/showthread.php?t=11156
function hsl2Hex(h, s, l) {
var m1, m2, hue;
var r, g, b
s /=100;
l /= 100;
if (s == 0)
r = g = b = (l * 255);
else {
if (l <= 0.5)
@0i0
0i0 / gist:1525535
Created December 28, 2011 00:10
tommorw night syntax highlighting
<script type="text/javascript" language="javascript" src="http://google-code-prettify.googlecode.com/svn/trunk/src/prettify.js"></script>
<script type="text/javascript" language="javascript" src="http://google-code-prettify.googlecode.com/svn/trunk/src/lang-css.js"></script>
<script type="text/javascript">
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
@0i0
0i0 / gist:1519811
Created December 25, 2011 22:05
javascript snippets
function getCookie(key){
var regEx = new RegExp(key+"=([^;]*)","g");
return regEx.exec(document.cookie)[1]
}
String.prototype.format = function () {
var args = arguments;
return this.replace(/\{\{|\}\}|\{(\d+)\}/g, function (curlyBrack, index) {
return ((curlyBrack == "{{") ? "{" : ((curlyBrack == "}}") ? "}" : args[index]));
});