Skip to content

Instantly share code, notes, and snippets.

View grimen's full-sized avatar

Jonas Grimfelt grimen

View GitHub Profile
sabderemane / workflow_full_v2.yml
Last active April 28, 2024 19:29
Full workflow of python with docker services (postgres), to run django tests
name: Test Workflow
on: push
runs-on: ubuntu-latest
image: postgres
grimen / generators-test.js
Last active January 23, 2019 09:41
Experiments with Node.js Generator API - partially requires Node 10.
/* =========================================
-------------------------------------- */
const fs = require('fs')
const { promisify } = require('util')
sleep = promisify(setTimeout)
grimen / streams-test.js
Last active January 23, 2019 09:41
Experiments with Node.js Stream API.
/* =============================================
------------------------------------------ */
const debug = require('debug')
const chalk = require('chalk')
const { Readable, Writable, Transform, pipeline } = require('stream')
eddieantonio /
Created March 30, 2017 20:43
Zero-dependency Python 3 and Node IPC using UNIX sockets
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
import socket
import json
server_address = '/tmp/example.sock'
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
absent1706 /
Last active April 5, 2023 03:50
Sqlalchemy: Truncate all tables
def truncate_db(engine):
# delete all table data (but keep tables)
# we do cleanup before test 'cause if previous test errored,
# DB can contain dust
meta = MetaData(bind=engine, reflect=True)
con = engine.connect()
trans = con.begin()
con.execute('SET FOREIGN_KEY_CHECKS = 0;')
for table in meta.sorted_tables:
darkwave /
Created March 12, 2016 22:42
Python proxy server to redirect calls from localhost to different address (change forward_to variable)
# This is a simple port-forward / proxy, written using only the default python
# library. If you want to make a suggestion or fix something you can contact-me
# at
# Distributed over IDC(I Don't Care) license
import socket
import select
import time
import sys
lelandbatey /
Last active June 16, 2024 13:44
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!


This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"


katowulf / diffList.js
Last active July 28, 2016 18:42
Diff services for monitoring objects and arrays, and creating changelists in Angular.js
* A diff utility that compares arrays and returns a list of added, removed, and updated items
* Returns an object with two methods:
* diff: do a one-time diff of two arrays
* watch: observe a variable on scope and report any changes to a callback
* Invoking the factory is done like so:
* <code>
* function(listDiff) {