This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Global | |
alias watch="watch " | |
alias cls="clear" | |
# Kubectl | |
alias k="kubectl" | |
alias kg="kubectl get" | |
alias kd="kubectl describe" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import requests | |
import requests_cache | |
requests_cache.install_cache('tmp/demo_cache', expire_after=120) | |
start_time = time.time() | |
for i in range(10): | |
r = requests.get('http://httpbin.org/delay/1?index={}'.format(i)) | |
print("Request {}{}: {}".format(i+1," (from cache)" if r.from_cache else " (live)",r.text)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>ANSIBlackColor</key> | |
<data> | |
YnBsaXN0MDDUAQIDBAUGKSpYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS | |
AAGGoKcHCBMXGyImVSRudWxs1QkKCwwNDg8QERJcTlNDb21wb25lbnRzVU5TUkdCXE5T | |
Q29sb3JTcGFjZV8QEk5TQ3VzdG9tQ29sb3JTcGFjZVYkY2xhc3NHMCAwIDAgMUYwIDAg | |
MAAQAYACgAbSFA0VFlVOU0lDQ4ADgAXSGA0ZGldOUy5kYXRhTxEbGAAAGxhhcHBsAhAA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* SimilarityUtils Library | |
* Compares two strings and based on the Sørensen–Dice coefficient it calculates the % of similarity between both strings. | |
* | |
* Usage: | |
* SimilarityUtils.compare("string","stringg").toFixed(2); | |
***/ | |
var SimilarityUtils = { | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const componentToHex = c => { | |
const hex = c.toString(16) | |
return hex.length === 1 ? '0' + hex : hex | |
} | |
const rgbToHex = (r, g, b) => '#' + [r, g, b].map(componentToHex).join('') | |
const hexToRgb = hex => hex.substring(1).match(/.{2}/g).map(x => parseInt(x, 16)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var distance = function(lat1, lon1, lat2, lon2){ | |
var R = 6371e3; // metres | |
var φ1 = lat1 * Math.PI / 180; | |
var φ2 = lat2 * Math.PI / 180; | |
var Δφ = (lat2-lat1)* Math.PI / 180; | |
var Δλ = (lon2-lon1)* Math.PI / 180; | |
var a = Math.sin(Δφ/2) * Math.sin(Δφ/2) + | |
Math.cos(φ1) * Math.cos(φ2) * | |
Math.sin(Δλ/2) * Math.sin(Δλ/2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
map = function() { | |
var datetime = this._id.getTimestamp(); | |
var created_at_minute = new Date(datetime.getFullYear(), | |
datetime.getMonth(), | |
datetime.getDate(), | |
datetime.getHours(), | |
datetime.getMinutes()); | |
emit(created_at_minute, {count: 1}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Crockford's Supplant method with support to string, numbers and booleans | |
* | |
* var myObj = { name: "John Doe", age: 27 } | |
* console.log("Hi my name is {name} and I am {age} years old.".supplant(myObj)); | |
* | |
* // Output: Hi my name is John Doe and I am 27 years old. | |
*/ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Works better with a black toolbar */ | |
-webkit-box-shadow: 0 2px 3px rgba(0, 0, 0, .25); /* web-kit browsers */ | |
-moz-box-shadow: 0 2px 3px rgba(0, 0, 0, .25); /* Firefox 3.5+ */ | |
box-shadow: 0 2px 3px rgba(0, 0, 0, .25); /* others */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
background: -webkit-radial-gradient(center, ellipse cover, #4786B3 0%,#2E5673 100%); /* twitter colors */ | |
/* cross-browser */ | |
background: #4786B3; /* for non-css3 browsers */ | |
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#4786B3', endColorstr='#2E5673'); /* for IE */ | |
background: -webkit-gradient(linear, left top, left bottom, from(#4786B3), to(#2E5673)); /* for webkit browsers */ | |
background: -moz-linear-gradient(top, #4786B3, #2E5673); /* for firefox 3.6+ */ | |
NewerOlder