Skip to content

Instantly share code, notes, and snippets.

View muesli's full-sized avatar

Christian Muehlhaeuser muesli

View GitHub Profile
@penguwin
penguwin / pre-push
Last active December 29, 2020 14:50
A git hook to prevent force pushing on master
#!/bin/bash
# Per-repo installation
# 1. Place this file in `.git/hooks/pre-push`
# 2. `chmod +x` it
clippy='
_________________________________________
/ It looks like youre trying to force \
| push on master... |
package main
import (
"fmt"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"plugin"
@mholt
mholt / macapp.go
Last active November 8, 2024 20:51
Distribute your Go program (or any single binary) as a native macOS application
// Package main is a sample macOS-app-bundling program to demonstrate how to
// automate the process described in this tutorial:
//
// https://medium.com/@mattholt/packaging-a-go-application-for-macos-f7084b00f6b5
//
// Bundling the .app is the first thing it does, and creating the DMG is the
// second. Making the DMG is optional, and is only done if you provide
// the template DMG file, which you have to create beforehand.
//
// Example use:
@miguelmota
miguelmota / rsa_util.go
Last active September 27, 2024 02:42
Golang RSA encrypt and decrypt example
package ciphers
import (
"crypto/rand"
"crypto/rsa"
"crypto/sha512"
"crypto/x509"
"encoding/pem"
"log"
)
#!/bin/sh
set -x
# adb shell pm list packages -d
# adb shell pm list packages
adb shell pm uninstall -k --user 0 com.sonymobile.entrance
adb shell pm uninstall -k --user 0 com.sonymobile.xperiatransfermobile
adb shell pm uninstall -k --user 0 com.sonymobile.phoneusage
adb shell pm uninstall -k --user 0 com.sonymobile.googleanalyticsproxy
@rivo
rivo / postgres.go
Last active July 7, 2024 14:28
A demo Go application (a PostgreSQL database browser) highlighting the use of the rivo/tview package. See https://github.com/rivo/tview/wiki/Postgres
package main
import (
"database/sql"
"fmt"
"net/url"
"os"
"reflect"
"regexp"
"strconv"
@fm3
fm3 / ff57-tabs-mousewheel.js
Last active June 13, 2018 07:13 — forked from benoitryder/ff57-tabs-mousewheel.js
Change tabs with mousewheel in Firefox 58
/* To enable changing tabs by using the mouse wheel,
* enter this code into the browser console (Ctrl+Shift+J) */
var onTabWheel = function(ev) {
if (ev.deltaMode == 1 /* DOM_DELTA_LINE */) {
var idx = gBrowser.tabContainer.getIndexOfItem(gBrowser.selectedTab);
var direction = ev.deltaY > 0 ? 1 : -1;
gBrowser.selectTabAtIndex((idx + direction) % gBrowser.tabs.length);
}
}
@posener
posener / go-shebang-story.md
Last active October 18, 2024 01:42
Story: Writing Scripts with Go

Story: Writing Scripts with Go

This is a story about how I tried to use Go for scripting. In this story, I’ll discuss the need for a Go script, how we would expect it to behave and the possible implementations; During the discussion I’ll deep dive to scripts, shells, and shebangs. Finally, we’ll discuss solutions that will make Go scripts work.

Why Go is good for scripting?

While python and bash are popular scripting languages, C, C++ and Java are not used for scripts at all, and some languages are somewhere in between.

@ageis
ageis / YubiKey-GPG-SSH-guide.md
Last active October 30, 2024 07:49
Technical guide for using YubiKey series 4 for GPG and SSH

YubiKey 4 series GPG and SSH setup guide

Written for fairly adept technical users, preferably of Debian GNU/Linux, not for absolute beginners.

You'll probably be working with a single smartcard, so you'll want only one primary key (1. Sign & Certify) and two associated subkeys (2. Encrypt, 3. Authenticate). I've published a Bash function which automates this slightly special key generation process.

This work, excluding the Arch Linux logo, is made available under CC0: https://creativecommons.org/publicdomain/zero/1.0/