Skip to content

Instantly share code, notes, and snippets.

View telemachus's full-sized avatar

Peter Aronoff telemachus

View GitHub Profile
package main
import (
"fmt"
)
func fib(n int) int {
fibs := make(map[int]int, n+1)
fibs[0] = 0
fibs[1] = 1
@raymond-w-ko
raymond-w-ko / indent.lua
Created December 4, 2012 20:15
better lua.vim indent file showcase
function foo(bar)
a = {}
end
function foo(bar)
a = {
stuff,
stasdtas,
asdf
}
@mike-burns
mike-burns / .msmtp
Last active December 23, 2022 14:56
FastMail + mutt
account default
host mail.messagingengine.com
port 587
protocol smtp
auth on
from mike@mike-burns.com
user mikeburns@fastmail.fm
password topsecretpassword!
tls on
tls_nocertcheck
@takatoshiono
takatoshiono / copy-digits.go
Last active December 28, 2022 00:19
CopyDigits function ref
package main
// ref: https://blog.golang.org/go-slices-usage-and-internals
// 1234 <-- digits
import (
"fmt"
"io/ioutil"
"regexp"
)
@AlmogBaku
AlmogBaku / bitly.go
Last active February 9, 2023 19:16
Golang Bitly: simple, stupid shortener written in go
package bitly
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
const BaseURL = "https://api-ssl.bitly.com/v4"
@lv10
lv10 / Build VIM with python3
Last active November 25, 2023 23:42
Install Vim 8 with Python, Python 3 support on Ubuntu 20.04
# make sure you don't have any soon to be forgotten version of vim installed
$ sudo apt-get remove --purge vim vim-runtime vim-gnome vim-tiny vim-gui-common
# Install Deps
$ sudo apt-get install build-essential cmake
$ sudo apt-get install python3-dev
#Optional: so vim can be uninstalled again via `dpkg -r vim`
$ sudo apt-get install checkinstall
@pjobson
pjobson / syncthing_ubuntu-mint_headless.md
Last active January 1, 2024 19:15
Syncthing Ubuntu/Mint Headless

Syncthing Ubuntu/Mint Headless

Syncthing: https://syncthing.net/

Syncthing is a free, open-source peer-to-peer file synchronization application available for Windows, Mac, Linux, Android, Solaris, Darwin, and BSD. It can sync files between devices on a local network, or between remote devices over the Internet. Data security and data safety are built into the design of the software.

This is written using Linux Mint 21.2 x86_64 using kernel 5.15.0-89-generic.

I couldn't find good directions for doing this, so here we go.

@mattmc3
mattmc3 / README.md
Last active January 2, 2024 00:50
zsh: zstyle examples

zstyle booleans

Setup foo,bar,baz boolean vars

zstyle ':example:foo' doit yes
zstyle ':example:bar' doit no
# leave baz unset
@lavalamp
lavalamp / The Three Go Landmines.markdown
Last active February 16, 2024 12:16
Golang landmines

There are three easy to make mistakes in go. I present them here in the way they are often found in the wild, not in the way that is easiest to understand.

All three of these mistakes have been made in Kubernetes code, getting past code review at least once each that I know of.

  1. Loop variables are scoped outside the loop.

What do these lines do? Make predictions and then scroll down.

func print(pi *int) { fmt.Println(*pi) }
@brunerd
brunerd / maclTackle.command
Last active February 23, 2024 11:28
A hacky example to clean the com.apple.macl attribute from a file using zip to sidestep SIP on Catalina
#!/bin/bash
#clean the com.apple.macl attribute from a file or folders using zip to sidestep SIP on Catalina
#WARNING: This will overwrite the original file/folders with the zipped version - DO NOT use on production data
#hold down command key at launch or touch /tmp/debug to enable xtrace command expansion
commandKeyDown=$(/usr/bin/python -c 'import Cocoa; print Cocoa.NSEvent.modifierFlags() & Cocoa.NSCommandKeyMask > 1')
[ "$commandKeyDown" = "True" -o -f /tmp/debug ] && set -x && xtraceFlag=1
#hacky example to clean the com.apple.macl attribute from a file using zip to sidestep SIP
: <<-EOL