Skip to content

Instantly share code, notes, and snippets.

View neurosnap's full-sized avatar

Eric Bower neurosnap

View GitHub Profile
@GllmR
GllmR / init.lua
Last active October 11, 2024 16:38
One file Neovim configuration
---@diagnostic disable: undefined-global
-------------------
-- EDITOR CONFIG --
-------------------
vim.opt.compatible = false
vim.opt.tabstop = 2 -- Two spaces for tab
vim.opt.softtabstop = 2
vim.opt.shiftwidth = 2 -- Two spaces for indentation
@cowboyd
cowboyd / 01-scope.ts
Last active March 29, 2023 16:22
Beefed up `Scope`
import type { Stream, Task, Operation, Result } from "./types.ts";
export interface Scope extends Operation<void> {
run<T>(operation: () => Operation<T>): Task<T>;
close(): Operation<void>;
created: Stream<Task<unknown>, void>;
enqueued: Stream<Operation<unknown>, void>;
dropped: Stream<Operation<unknown>, void>;
results: Stream<{task: Task<unknown>, result: Result<unknown>}, void>;
}
@geelen
geelen / maybe-error.md
Last active January 4, 2024 22:51
"Maybe Error" pattern in Typescript

"Maybe Error" pattern in Typescript

TL;DR? 👉 Implementation.

Inspiration

So one of the things I've liked about working with Go is that you use multiple return values a lot, with early exits that work as a kind of guard:

func GetUserFromAuth(name string, auth Auth) (error, User) {
@kahole
kahole / index.html
Last active October 10, 2024 20:28
*scratch*.js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>*scratch*</title>
<style>
body {
font-family: Hack, Menlo, Monaco, 'Droid Sans Mono', 'Courier New', monospace;
white-space: pre;
@yudai
yudai / README.md
Created November 29, 2017 01:04
tmux + mosh OSC 52 clipboard paste hack

Problem

Now tmux, mosh and iTerm2 support the OSC 52 sequence that enables clipboard sharing. However, there is a trap that prevents them from working together.

Mosh accepts OSC 52 sequences with the c; option. However, tmux doesn't send that option when it emits OSC 52 sequences, which means you cannot use tmux and mosh together with the default configuration.

Workaround

You can override the OSC 52 sequence generated by tmux by adding the following line to your tmux.conf.

@mterwill
mterwill / USAGE.md
Last active April 27, 2025 15:04
Beancount importers, scripts, etc.

Note: everything here is pretty specific to my usage/accounts and not written for public use... You'll probably have to tweak a bunch of stuff.

$ bean-extract config.py ~/Downloads # the csvs should be in here
@zeitiger
zeitiger / gist:a57ead8904ee9a6ec4c3
Created March 9, 2016 08:21
How to convert shp to geojson under Mac OS X
#install gdal
brew install gdal
#convert 1:1
ogr2ogr -f "GeoJSON" file.geojson file.shp
#convert loose, higher tolerance in simplify reduce files size and lost data precision
ogr2ogr -simplify 0.000001 -f "GeoJSON" file.geojson file.shp
@punkdata
punkdata / git-get-files-by-size.py
Last active September 25, 2022 00:36
Git this script lists the files that are larger than the size you specify. Example use: python git-find-big-files.py fix-remove-files 1000000 (file size in MBs)
#!/usr/bin/python
# run the script: python git-find-big-files.py <the branch> <file size>
# Example use: python git-find-big-files.py fix-remove-files 1000000 (this value equals 1 Megabyte)
# the Fix-remove-files specifies the branch that you are cleaning
import os, sys
def getOutput(cmd):
return os.popen(cmd).read()
@parmentf
parmentf / GitCommitEmoji.md
Last active April 24, 2025 05:25
Git Commit message Emoji
@gaearon
gaearon / slim-redux.js
Last active December 3, 2024 06:34
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
}
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {