Skip to content

Instantly share code, notes, and snippets.

View emyller's full-sized avatar
🏠
Working from home

Evandro Myller emyller

🏠
Working from home
  • Santos, SP - Brazil
View GitHub Profile
@mafonso
mafonso / list-all-access-keys.sh
Last active October 10, 2023 05:19
List Access Keys for all IAM users
for user in $(aws iam list-users --output text --no-cli-pager | awk '{print $NF}'); do
aws iam list-access-keys --user $user --output text --no-cli-pager
test $? -gt 128 && exit
done
@zacharydenton
zacharydenton / models.py
Created February 18, 2011 02:27
Geodesic Distance Between Points in GeoDjango
from itertools import tee, izip
from django.contrib.gis.db import models
from django.contrib.gis.measure import Distance
from geopy.distance import distance as geopy_distance
def pairwise(iterable):
"s -> (s0,s1), (s1,s2), (s2, s3), ..."
a, b = tee(iterable)
/* Python(ish) string formatting:
* >>> format('{0}', ['zzz'])
* "zzz"
* >>> format('{x}', {x: 1})
* "1"
*/
var format = (function() {
var re = /\{([^}]+)\}/g;
return function(s, args) {
return s.replace(re, function(_, match){ return args[match]; });
// The outrageous totally awesomely unoptimized and hard way of doing
// the stuff :D
(function() {
var c, list
, letters = {}
, str = "ah, yes, for all the letters, you'll need"
+ "a loop... i read it wrong."
;
str.replace(/\s|\S/g, function(match) {