Skip to content

Instantly share code, notes, and snippets.

accounts.cdn.mozilla.net
addons.cdn.mozilla.net
addons-discovery.cdn.mozilla.net
addons.mozilla.org
aus5.mozilla.org
blocklist.addons.mozilla.org
blocklists.settings.services.mozilla.com
blog.mozilla.org
bugzilla.mozilla.org
developer.mozilla.org
@psycho23
psycho23 / timediff.sh.txt
Last active July 23, 2017 03:46
timediff.sh possible solutions
PROBLEM by AW
I need someone to create a command that does this for me `timediff 13:54:05
14:06:42 #outputs: 00:12:37` If you put that command on github I 94% promise to
star the repository or gist it is in for at least 3 days :0)
SOLUTION1 (untested) by PH
timediff () { date +%H:%M:%S -d "1970-01-01 + $(( $(date +%s -d "1970-01-01 $timeb") - $(date +%s -d "1970-01-01 $timea") )) seconds" ; }
SOLUTION2VERSION1 by KU
date +%T -d @$(( $( date +%s -d "$1" ) - $( date +%s -d "$2" )))
String fxns (in,not in)
from str (.center,.count,.find,.index,.isdigit,.isalpha,
.join,len,.ljust,.lstrip,.rjust,.split)
Array/List fxns (.append,.clear,.copy,.count,.extend,in,.index,
.insert,list,not in,.pop,.remove,.reverse,.sort)
Dict/Hash fxns (.values,.keys,in,not in)
mydict = { 1:'sup', 's':'a value' }
Variable fxns (False,int,is,None,range,repr,str,True,type)
Math fxns (**,pow,round)
from float (.is_integer)
#what's not here: continue{} block, OOP (mostly), threads, POD,
# exporting subroutines (mostly), packages, debugging,
# special variables (mostly), regular expressions (mostly).
String fxns (chomp,chop,chr,index,lc,length,oct,ord,rindex,split,sprintf,substr,uc,ucfirst)
Array/List fxns (@ARGV,grep,join,map,pop,push,reverse,shift,sort,splice,qw//,unshift,List::Util=shuffle)
Hash fxns (delete,each,exists,keys,values)
Variable fxns (defined,ref,scalar)
All fxns(printf,undef,Data::Dumper)
Exception fxns ($@[eval error])
Math fxns (**,abs,hex,int,oct,rand,sqrt,Math::Trig=:pi[pi])
¯\_(ツ)_/¯
(• ◡•)
(¬‿¬)
ಠ╭╮ಠ
(~˘▾˘)~
@psycho23
psycho23 / mumble-server-hostnames-list.txt
Last active July 23, 2017 03:32
mumble-addresses.txt April 18, 2017
armshq.org
atl.clanwarz.com
ball.holdings
beardedclams.net
bear.mumbleboxes.com
b-f-f.net
br3ntor.us
cbytes.net
compu.ml
d4n.nl
@psycho23
psycho23 / clearing-memory-before-program-exit.txt
Last active April 13, 2017 17:31
Before you exit ANY C program, you want to first clear all memory so that Mr. Kernel is happy with you.
#include <stdio.h>
#include <limits.h>
int main(void){
/* do your program here, for example: */
int *p_array;
double *d_array;
p_array = (int *)malloc(sizeof(int)*50); // allocate 50 ints
d_array = (int *)malloc(sizeof(double)*100); // allocate 100 doubles