Skip to content

Instantly share code, notes, and snippets.

View antonsukhonosenko's full-sized avatar

Anton Sukhonosenko antonsukhonosenko

View GitHub Profile

Here's something I spent a long time debugging, so I'm making this gist to help others find the solution when searching.

Summary

postgres 12 on MacOS will cause crashes when forking. The solution is to do one of these two things:

  • add gssencmode: "disable" to database.yml
  • if using homebrew: uninstall postgres, update homebrew, reinstall postgres

Here's some discussion:

@phil-kahrl
phil-kahrl / recursive-fetch-with-retry.js
Last active February 11, 2022 08:36
Fetch with retry
const fetch = require('node-fetch');
const MAX_RETRIES = 5
const fetchWithRetry = (origResolve, origReject, attemptCount) => {
attemptCount = attemptCount ? attemptCount : 0
const url = process.argv[2]
if(!url){
console.log('no url passed in')
return
}
function asyncQuicksort(xs = []) {
// get the "head" and "tail" of the array
let [h, ...t] = xs
// create the initial Promise
return new Promise((res, rej) => {
// resolve immediately if "head" was undefined
if (!h) return res([])
// recurse for the "left" half of the partition
asyncQuicksort(t.filter(a => a <= h)).then(a => {
// recurse for the "right" half of the partition
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active April 10, 2025 09:21
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

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:

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

Results

@endolith
endolith / export_google_starred_locations.py
Created October 16, 2012 02:29
Export Google Maps starred locations
# -*- coding: utf-8 -*-
"""
Go to Google Bookmarks: https://www.google.com/bookmarks/
On the bottom left, click "Export bookmarks": https://www.google.com/bookmarks/bookmarks.html?hl=en
After downloading the html file, run this script on it to generate a KML.
"""
@dawsontoth
dawsontoth / LightweightClickableGrid.js
Created February 16, 2011 17:45
Lightweight clickable grids in Appcelerator Titanium; put this in an app.js!
/**
* Creates a grid that you can click on.
* @param options
*/
function createGrid(options) {
// default options
var defaultOptions = {
gridViewOptions: {
top: 0,