Skip to content

Instantly share code, notes, and snippets.

@m-radzikowski
m-radzikowski / script-template.sh
Last active July 13, 2024 13:20
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@bluet
bluet / mariadb-temporal-table.md
Last active July 6, 2020 08:29
Versioning database data with MariaDB Temporal Table
@tomhicks
tomhicks / plink-plonk.js
Last active July 22, 2024 09:51
Listen to your web pages
@emisjerry
emisjerry / test9.ahk
Created September 29, 2019 07:14
使用AutoHotkey快速切換語言鍵盤,和超難用的Ctrl/Alt+Shift說再見!(AHK #9)
#SingleInstance Force
!1::
SetDefaultKeyboard(0x0409) ;; 切換為英文輸入
return
!2::
SetDefaultKeyboard(0x0404) ;; 切換為中文輸入
return
@slikts
slikts / Linuxifying Windows.md
Last active September 4, 2023 07:30
Linuxifying Windows

nelabs.dev

Linuxifying Windows for development

This guide is for 'linuxing-up' Windows as a development environment; it focuses on setting up [WSL], an Ubuntu Hyper-V virtual machine, [wsltty] (a nice terminal emulator) and various tweaks.

Rationale

@koop
koop / ensure-cert-macos.sh
Created November 28, 2017 20:27
Ensures a certificate is in the macOS system keychain.
#!/bin/bash
# Usage
# $ ./install-cert-macos.sh "/path/to/cert"
CERT_PATH="$1"
# First, grab the SHA-1 from the provided SSL cert.
CERT_SHA1=$(openssl x509 -in "$CERT_PATH" -sha1 -noout -fingerprint | cut -d "=" -f2 | sed "s/://g")
# Next, grab the SHA-1s of any standard.dev certs in the keychain.
# Don't return an error code if nothing is found.
@romainl
romainl / vanilla-linter.md
Last active July 22, 2024 17:18
Linting your code, the vanilla way

Linting your code, the vanilla way

You may want a linter plugin to lint your code in Vim but you probably don't need it. At least try the built-in way before jumping on the plugin bandwagon.

Defining makeprg

autocmd FileType <filetype> setlocal makeprg=<external command>

This autocommand tells Vim to use <external command> when invoking :make % in a <filetype> buffer. You can add as many similar lines as needed for other languages.

@oubiwann
oubiwann / appify.sh
Last active May 25, 2024 19:51 — forked from advorak/appify.sh
appify — create the simplest possible Mac app from a shell script (adds an application icon)
#!/usr/bin/env bash
VERSION=4.0.1
SCRIPT=`basename "$0"`
APPNAME="My App"
APPICONS="/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/GenericApplicationIcon.icns"
OSX_VERSION=`sw_vers -productVersion`
PWD=`pwd`
function usage {
@zqqf16
zqqf16 / icon.sh
Created July 19, 2016 11:24
Create .icns & .iconset from .png
#!/bin/bash
# Usage: ./icon.sh icon.png
icon=$1
icon_name=${icon%.*}
icon_dir=${icon}.iconset
icon_tmp_path=/tmp/${icon_dir}
@romainl
romainl / _rnb.md
Last active July 8, 2024 17:22
RNB, a Vim colorscheme template