Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am cabadsanchez on github.
  • I am cabad (https://keybase.io/cabad) on keybase.
  • I have a public key ASBnxLT6t61wkAc_2VM5KnTchn4vCoh-ebbkd4X4PCwcxAo

To claim this, I am signing this object:

@cabadsanchez
cabadsanchez / cryptographically_secure_random_strings.php
Created November 30, 2017 08:48 — forked from raveren/cryptographically_secure_random_strings.php
Generate cryptographically secure random strings. Based on Kohana's Text::random() method and this answer:http://stackoverflow.com/a/13733588/179104
function random_text( $type = 'alnum', $length = 8 )
{
switch ( $type ) {
case 'alnum':
$pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
break;
case 'alpha':
$pool = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
break;
case 'hexdec':
@cabadsanchez
cabadsanchez / pandas_tutorial.ipynb
Created April 28, 2017 08:21
10 Minutes to pandas
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cabadsanchez
cabadsanchez / gist:baaddec2470a7feb3d67ce9f92409258
Created April 26, 2017 10:28
diff two directories by filename
diff -qr dir1 dir2
@cabadsanchez
cabadsanchez / gist:541141ae526e8cd1419f9a9807777780
Created April 18, 2016 10:46
Pereza de pensar un mensaje para el commit...
git commit -m "$(curl -s whatthecommit.com/index.txt)"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cabadsanchez
cabadsanchez / gist:5829ffb864be639b30bb
Last active May 11, 2016 08:56
Easily discover repeated words in a list. Outputs the list sorted by the number of times its words appear.
sort <file> | uniq -c | sort -nr
@cabadsanchez
cabadsanchez / rasterize.js
Created May 14, 2015 09:55
Modified rasterize.js from PhantomJS examples (captures element with class 'phantomjs')
var page = require('webpage').create(),
system = require('system'),
address, output, size;
if (system.args.length < 3 || system.args.length > 5) {
console.log('Usage: rasterize.js URL filename [paperwidth*paperheight|paperformat] [zoom]');
console.log(' paper (pdf output) examples: "5in*7.5in", "10cm*20cm", "A4", "Letter"');
console.log(' image (png/jpg output) examples: "1920px" entire page, window width 1920px');
console.log(' "800px*600px" window, clipped to 800x600');
phantom.exit(1);
@cabadsanchez
cabadsanchez / mapping.json
Last active August 29, 2015 14:17
Elasticsearch tweet mapping for Numbat
{
"tweet":{
"properties":{
"coordinates":{
"properties":{
"coordinates":{
"type":"geo_point"
}
}
},