Skip to content

Instantly share code, notes, and snippets.

View daspecster's full-sized avatar
🏠
Working remote

Thomas Schultz daspecster

🏠
Working remote
View GitHub Profile
@giannisp
giannisp / gist:ebaca117ac9e44231421f04e7796d5ca
Last active July 14, 2024 18:27
Upgrade PostgreSQL 9.6.5 to 10.0 using Homebrew (macOS)
After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work.
The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0."
Database files have to be updated before starting the server, here are the steps that had to be followed:
# need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default
brew unlink postgresql
brew install [email protected]
brew unlink [email protected]
brew link postgresql
@skoegl
skoegl / image_web_detection.py
Created September 4, 2017 21:41
Using google cloud vision api on google app engine with python - bare metal
# -*- coding: utf-8 -*-
__author__ = "Stefan Kögl"
from json import dumps, loads
from google.appengine.api.urlfetch import fetch, POST
def vision_api_web_detection(uri):
@gagarine
gagarine / install-clamav-osx.md
Last active October 1, 2024 20:38
Howto Install clamav on OSX with brew

Howto Install clamav on OSX with brew

Note: on legacy intel system the path may be /usr/local/etc/clamav instead of /opt/homebrew/etc/clamav/

$ brew install clamav
$ cd /opt/homebrew/etc/clamav/
$ cp freshclam.conf.sample freshclam.conf
@yossorion
yossorion / what-i-wish-id-known-about-equity-before-joining-a-unicorn.md
Last active November 3, 2024 17:14
What I Wish I'd Known About Equity Before Joining A Unicorn

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would

# coding: utf-8
# Imports
import os
import cPickle
import numpy as np
import theano
import theano.tensor as T
@remarkablemark
remarkablemark / README.md
Last active June 8, 2024 21:48
Classes - ES5 vs ES6

JavaScript Classes - ES5 vs ES6

An example that shows the difference between creating a JavaScript class and subclass in ES5 and ES6.

Reference

@jg75
jg75 / subprocs.py
Last active August 29, 2015 14:24
import threading, os, logging
from math import sqrt
class threadsafe_iterator:
def __init__(self, iterator):
self.iterator = iterator
self.lock = threading.Lock()
def __iter__(self):
import os
import logging
from math import sqrt
def generate_primes(number):
logger = logging.getLogger(str(os.getpid()) + ':logger')
for num in range(number + 1):
# prime numbers are greater than 1
find . | grep '\.py' | grep -v -e '/venv/' -e '(' -e ')' | xargs -I % grep import % | sed -e 's/^[ ]*//' | grep -e '^from ' -e '^import ' | awk '{print $2}' | sed -e 's/^[\.]*//' | cut -d\. -f1 | tr '[A-Z]' '[a-z]' | sort -bfd | uniq -c | sort -nr | head -20
@jdpedrie
jdpedrie / DI.js
Last active August 29, 2015 14:09
Angular-style Dependency Injection!
var di = function() {
var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
var ARGUMENT_NAMES = /([^\s,]+)/g;
var deps = {};
var getParamNames = function(func) {
var fnStr = func.toString().replace(STRIP_COMMENTS, '');
var result = fnStr.slice(fnStr.indexOf('(')+1, fnStr.indexOf(')')).match(ARGUMENT_NAMES);
if(result === null) {