Skip to content

Instantly share code, notes, and snippets.

View elsbrock's full-sized avatar
💻

Simon Elsbrock elsbrock

💻
  • Europe, Germany
  • 14:45 (UTC +02:00)
View GitHub Profile
@progrium
progrium / bash.sh
Created February 17, 2015 14:19
Comparing natural brevity and concise expressiveness between Go and shell/Bash for certain tasks using each tool's "standard" library.
curl -s "$url" | tar -zxC "$dest"
@elsbrock
elsbrock / pedantically_commented_playbook.yml
Created December 2, 2015 21:14 — forked from marktheunissen/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
@grncdr
grncdr / gist:4554165
Last active December 11, 2015 05:48 — forked from jlongster/gist:3881008
hygienic destructuring var assignments with sweet.js
macro $do {
case ($($x = $y) (,) ...) $body => {
(function ($x (,) ...) $body)($y (,) ...)
}
case $name ($($x = $y) (,) ...) $body => {
(function $name ($x (,) ...) $body)($y (,) ...)
}
}
macro $var {
@solidsnack
solidsnack / mesos-attrs-causes-slave-upgrade
Created December 17, 2013 19:34
Can be fixed with: /usr/local/sbin/mesos-slave --recover=cleanup
I1217 19:23:11.844920 2201 state.cpp:33] Recovering state from '/tmp/mesos/meta'
Incompatible slave info detected.
------------------------------------------------------------
Old slave info:
hostname: "ip-10-46-210-228.ec2.internal"
webui_hostname: "ip-10-46-210-228.ec2.internal"
resources {
name: "cpus"
type: SCALAR
scalar {
@softwaredoug
softwaredoug / hyperLogLog.c
Created February 3, 2015 04:01
Educational HyperLogLog demo in C
#include "stdio.h"
#include "stdlib.h"
unsigned int max(unsigned int a, unsigned int b) {
return a > b ? a : b;
}
unsigned int bucket(unsigned int val) {
return val & 0xF0000000 >> 28;
}
@kamaljoshi
kamaljoshi / check_cloudflare.rb
Last active May 27, 2017 21:57
This script collects domains from your Chrome history for the default profile and checks to see if they are being proxied through Cloudflare by checking presence of a header.
# Except sqlite3 all the libraries are standard that should be present with a Ruby installation.
# If you don't have sqlite3 installed. Use `gem install sqlite3`
require 'fileutils'
require 'sqlite3'
require 'uri'
require 'net/http'
require 'set'
require 'thread'
@benzkji
benzkji / search_indexes.py
Created December 8, 2015 07:15
haystack index for django-filer PDFs
# coding: utf-8
from __future__ import unicode_literals
import os
from pdfminer.pdfdocument import PDFEncryptionError
from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter
from pdfminer.converter import TextConverter
from pdfminer.layout import LAParams
from pdfminer.pdfpage import PDFPage
from cStringIO import StringIO
@pghalliday
pghalliday / auto-build-and-deploy-github-pages-with-travis-ci.sh
Last active October 7, 2019 05:54
Auto build and deploy GitHub pages with Travis-CI
#!/bin/bash
set -e
# Deploy built site to this branch
TARGET_BRANCH=master
# Sync the contents of this directory where the site should have been built
SOURCE_DIR=_site
if [ ! -d "$SOURCE_DIR" ]; then
echo "SOURCE_DIR ($SOURCE_DIR) does not exist, build the source directory before deploying"
@zakx
zakx / damazon.py
Last active August 30, 2020 00:01 — forked from trehn/damazon.py
#!/usr/bin/python2
# setup: pip install requests beautifulsoup4
from decimal import Decimal
import requests
from bs4 import BeautifulSoup
import sys
# Session setup
@super3
super3 / payout.MD
Last active September 8, 2020 01:48
Storj Bridge Payout Formula

Payout Formula

paymentModelFunction = function(gbHours, telemReports, downloadedBytes) {
 gbHoursScaled =  (gbHours - mean(gbHours)) / sd(gbHours)
 telemReportsScaled =  (telemReports - mean(telemReports)) / sd(telemReports)
 downloadedBytesScaled = (downloadedBytes - mean(downloadedBytes)) / sd(downloadedBytes)
 
 basePayout = 10
 ghHourPayout = 12.2221 * gbHoursScaled
 telemReportsPayout = 0.1452 * telemReportsScaled