This file contains hidden or 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
dev-test: | |
export $(shell grep -v '^#' env.test | xargs) && \ | |
cd src && \ | |
python manage.py test -k --failfast -v2 $(TARGET) |
This file contains hidden or 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
-- Create a group | |
CREATE ROLE readaccess; | |
-- Grant access to existing tables | |
GRANT USAGE ON SCHEMA public TO readaccess; | |
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess; | |
-- Grant access to future tables | |
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readaccess; |
This file contains hidden or 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
reddit.com | |
news.ycombinator.com | |
businessinsider.com | |
nytimes.com | |
chron.com | |
expressen.se | |
dn.se | |
aftonbladet.se | |
wsj.com | |
usatoday.com |
This file contains hidden or 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
from __future__ import division | |
import numpy as np | |
RADIUS_OF_EARTH_IN_KM = 6371.01 | |
def haversine(lat1, lon1, lat2, lon2): | |
""" | |
Utility to calcutlate distance between two pointtodo explain regarding height | |
coverting from geodisc co-ordinate to cartestian gives errors when distances are further apart |
This file contains hidden or 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
# this is a little "one-liner" to peek at all my docker secrets. | |
# I use this on development and test machines when debugging | |
echo "" | |
echo "-------------------------" | |
echo "Peek at docker secrets..." | |
echo "-------------------------" | |
docker service create --name peeker \ | |
$(docker secret ls | sed '1d'| awk '{print "--secret " $2}'|sort -k2|xargs echo) busybox \ | |
sh -c 'for i in `ls /run/secrets/*`; do echo "$(basename $i): $(cat $i)"; done' > /dev/null 2>&1 && \ |
This file contains hidden or 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
sudo fallocate -l 2G /swapfile | |
sudo chmod 600 /swapfile | |
sudo mkswap /swapfile | |
sudo swapon /swapfile | |
sudo echo "/swapfile none swap sw 0 0" >> /etc/fstab; |
This file contains hidden or 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
############################################################################### | |
# HELP / DEFAULT COMMAND | |
############################################################################### | |
.PHONY: help | |
help: | |
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) |
This file contains hidden or 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.sleep | |
import zmq | |
context = zmq.Context() | |
socket = context.socket(zmq.PUB) | |
socket.bind('tcp://127.0.0.1:2000') | |
# Allow clients to connect before sending data | |
sleep(10) | |
socket.send_pyobj({1:[1,2,3]}) |
This file contains hidden or 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 | |
# Author: Carl Loa Odin <[email protected]> | |
# https://gist.github.com/loa/435da12af9494a112daf | |
test_res=0 | |
function get_git_version() { | |
version=$(git describe --tags 2> /dev/null) | |
if [ $? -eq 128 ]; then | |
# Return initial version incase no tags is found |
This file contains hidden or 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
--[[ | |
Author: Mark Anderson (https://github.com/undernewmanagement) | |
This is for users of hammerspoon, a neat little utility to script your OSX environment | |
This is a little snippet I use for autologin on applications that I develop. | |
I find that saving a few keystrokes here and there 100 times a day makes me a little happier. | |
]]-- |