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
# Put this in your ~/.zshrc to pull all repos in your git repos dir | |
export GIT_REPOS_DIR="~/complete-here/git" | |
pullall() { | |
failed=( ) | |
cd $GIT_REPOS_DIR | |
for D in */; do cd $D; echo "Pulling $D"; git pull -r || failed+=($D); if [ $(git_current_branch) != 'master' ]; then failed+="($D) not on master"; fi; cd ..; done | |
cd - | |
echo "Failed: $failed" | |
} |
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
def interwine_element_into_list(lst, elem): | |
""" Usage example: ([1,2,3], 0) => [1,0,2,0,3,0] """ | |
res = [item for pair in zip(lst, [elem]*len(lst)) for item in pair] | |
return res |
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/bash | |
echo "Installing brew (MacOS package manager)" | |
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
echo "Installing needed tools for development" | |
brew install gcc asdf coreutils gpg zlib mongodb rabbitmq yarn libxmlsec1 git cask zsh pkg-config readline openssl | |
echo "Install python and node with asdf" | |
source /usr/local/opt/asdf/asdf.sh |
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
# -*- coding: utf-8 -*- | |
# main.py | |
from wsgiref.simple_server import make_server | |
from pyramid.config import Configurator | |
from pyramid.response import Response | |
from pyramid.security import forget | |
from pyramid.view import view_config | |
from pyramid.httpexceptions import HTTPFound | |
from authomatic import Authomatic |
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
db.getMongo().getDBNames().forEach(function (dbName) { | |
if (dbName != "config" && dbName != "local") { | |
print("Changing Database: " + dbName); | |
var curr_db = db.getSiblingDB(dbName); | |
curr_db.changeUserPassword("myuser", "abc123"); | |
} | |
}); |
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
# deletes all rabbitmq queues locally if they fucked or needs purging | |
delqueues() { | |
rabbitmqadmin -f tsv -q list queues name | while read queue; do rabbitmqadmin delete queue name=${queue}; done | |
} |
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
brew install moreutils | |
cd ~ | |
zsh -xv 2>&1 | ts -i "%.s" > zsh_startup.log | |
sort --field-separator=' ' -r -k1 zsh_startup.log> sorted.log | |
# Start a new shell | |
head sorted.log # Will show slowest operation first |
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
server { | |
server_name openstreetmap-tiles-cacheproxy.mydomain.com; | |
location / { | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X_FORWARDED_PROTO http; | |
proxy_set_header Host $http_host; | |
add_header X-Cache-Status-Local $upstream_cache_status; | |
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 boto3 | |
def get_local_aws_credentials(): | |
session = boto3.session.Session() | |
credentials = session.get_credentials().get_frozen_credentials() | |
return {'access_key': credentials.access_key, | |
'secret_key': credentials.secret_key, | |
'region': session.region_name} |
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/bash | |
krand() { | |
# Outputs random 12 chars string including numbers, special chars and lower+upper case | |
dd if=/dev/urandom count=1 2>/dev/null | base64 | head -1 | cut -c4-15 | |
} |
OlderNewer