Skip to content

Instantly share code, notes, and snippets.

View emersion's full-sized avatar

Simon Ser emersion

View GitHub Profile
import sys
def to_octets(ip):
return [int(i) for i in ip.split('.')]
def dotless_decimal(ip):
octets = to_octets(ip)
result = octets[0] * 16777216 + octets[1] * \
@mikroskeem
mikroskeem / Arch Linux btrfs install.md
Last active October 8, 2023 18:27 — forked from artizirk/Arch Linux btrfs install.md
Arch Linux installation on btrfs subvolumes

Arch Linux btrfs install

NOTE: Last update to this gist was on Jun 2, 2018. Most of the things here are out of date (e.g consider using zstd for transparent compression instead of lzo), so do your own research as well. Take care!

0. Prerequisites

  • Plenty of storage - snapshots will take (sort of) a lot of space
  • Latest Arch Linux install iso because those have newer kernels and more bugfixes in btrfs.
  • Have previous experience with installing Arch (like you can install arch with a blind fold).
  • Read everything through
@denji
denji / golang-tls.md
Last active April 29, 2024 03:39 — forked from spikebike/client.go
Simple Golang HTTPS/TLS Examples

Moved to git repository: https://github.com/denji/golang-tls

Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
@tadly
tadly / pacaur_install.sh
Last active August 30, 2023 13:15
A simple shell script to quickly / easily install "pacaur" on archlinux
#!/bin/sh
#
# !!! IMPORTANT !!!
# As of 2017-12-14, pacaur is unmaintained (https://bbs.archlinux.org/viewtopic.php?pid=1755144#p1755144)
# For alternatives see the arch wiki: https://wiki.archlinux.org/index.php/AUR_helpers#Active
# pacaur seems to get occasional updates to fix breaking changes due to pacman updates though.
#
# If you are new to arch, I encourage you to at least read and understand what
# this script does befor blindley running it.
# That's why I didn't make a one-liner out of it so you have an easier time
@stuart-warren
stuart-warren / simple-gpg-enc.go
Last active October 11, 2023 01:21
golang gpg/openpgp encryption/decryption example
package main
import (
"bytes"
"code.google.com/p/go.crypto/openpgp"
"encoding/base64"
"io/ioutil"
"log"
"os"
)
@dmitshur
dmitshur / gist:6927554
Last active September 17, 2023 07:35
[Legacy GOPATH mode] How to `go get` private repos using SSH key auth instead of password auth.

WARNING: This gist was created in 2013 and targets the legacy GOPATH mode. If you're reading this in 2021 or later, you're likely better served by reading https://tip.golang.org/cmd/go/#hdr-Configuration_for_downloading_non_public_code and https://golang.org/ref/mod#private-modules.

$ ssh -A vm
$ git config --global url."git@github.com:".insteadOf "https://github.com/"
$ cat ~/.gitconfig
[url "git@github.com:"]
	insteadOf = https://github.com/
$ go get github.com/private/repo && echo Success!
Success!
@ixxra
ixxra / school-wpa
Created October 10, 2013 15:17
Simple configuration for netctl to connect to a WPA2 network (@myschool)
Description='A wireless connection using a custom network block configuration'
Interface=wlp3s0
Connection=wireless
Security=wpa-configsection
IP=dhcp
WPAConfigSection=(
'ssid="university-ssid"'
'scan_ssid=1'
'key_mgmt=WPA-EAP'
'identity="username"'
@freeformz
freeformz / WhyILikeGo.md
Last active October 6, 2022 23:31
Why I Like Go

A slightly updated version of this doc is here on my website.

Why I Like Go

I visited with PagerDuty yesterday for a little Friday beer and pizza. While there I got started talking about Go. I was asked by Alex, their CEO, why I liked it. Several other people have asked me the same question recently, so I figured it was worth posting.

Goroutines

The first 1/2 of Go's concurrency story. Lightweight, concurrent function execution. You can spawn tons of these if needed and the Go runtime multiplexes them onto the configured number of CPUs/Threads as needed. They start with a super small stack that can grow (and shrink) via dynamic allocation (and freeing). They are as simple as go f(x), where f() is a function.

@vitalyrotari
vitalyrotari / touch.js
Last active October 22, 2021 22:01
jQuery Touch Gestures
jQuery Touch Gestures ported from QUOjs
@see http://quojs.tapquo.com/
Version 1.1
-- @add singleTap event
-- @fix doubleTap event
-- @fix hold event