Skip to content

Instantly share code, notes, and snippets.

@jehiah
jehiah / simple_args_parsing.sh
Created March 4, 2011 16:56
a simple way to parse shell script arguments
#!/bin/sh
#
# a simple way to parse shell script arguments
#
# please edit and use to your hearts content
#
ENVIRONMENT="dev"
@nelanka
nelanka / Default (OS X).sublime-keymap
Last active November 15, 2019 03:10
Sublime Text 3 - User Key Bindings (IntelliJ IDEA Style) - OS X
[
{ "keys": ["super+y"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Line.sublime-macro"} },
// { "keys": ["super+d"], "command": "duplicate_line" }, -- Default is super+shift+D
{ "keys": ["super+`"], "command": "toggle_side_bar" },
{ "keys": ["super+shift+up"], "command": "swap_line_up" },
{ "keys": ["super+shift+down"], "command": "swap_line_down" },
{ "keys": ["ctrl+tab"], "command": "next_view" },
{ "keys": ["ctrl+shift+tab"], "command": "prev_view" },
{ "keys": ["alt+m"], "command": "markdown_preview", "args": {"target": "browser", "parser":"markdown"} }
]
cd /Library/Preferences
sudo rm com.sophos.sav.plist

cd /Library/Application\ Support/Sophos/cloud/Installer.app/Contents/MacOS/tools/
sudo ./InstallationDeployer —force_remove
@teknoraver
teknoraver / unixhttpc.go
Last active November 7, 2024 14:29
HTTP over Unix domain sockets in golang
package main
import (
"context"
"flag"
"fmt"
"io"
"net"
"net/http"
"os"
cd /Library/Preferences
sudo rm com.sophos.sav.plist
--or--
sudo rm com.sophos.*

cd /Library/Application\ Support/Sophos/cloud/Installer.app/Contents/MacOS/tools/
sudo ./InstallationDeployer --force_remove

Sometimes the Sophos virus can exist in the /Library/Application.../Sophos/saas folder
@ldez
ldez / gmail-github-filters.md
Last active November 7, 2024 14:56
Gmail and GitHub - Filters

Gmail and GitHub

How to filter emails from GitHub in Gmail and flag them with labels.

The labels in this document are just examples.

Pull Request

Filter Label
-- 100 million INSERTs benchmark
-- stock PostgreSQL 9.6 setup running on an Ubuntu 16.04 workstation
-- PK TYPE INSERT* time (ms) Relative time AVG throughput (op/s)
------------------------------------------------------------------------
-- BIGSERIAL 242,849.46 1.00 411,777.73
-- UUID COMB 337,028.15 1.39 296,711.12
-- UUID 1 470,385.37 1.94 212,591.65
-- UUID 4 7,808,502.45 32.15 12,806.55
------------------------------------------------------------------------
@sgdan
sgdan / gzip.kts
Last active November 19, 2024 18:38
Kotlin code to compress/uncompress a string with gzip
import java.io.ByteArrayOutputStream
import java.io.File
import java.nio.charset.StandardCharsets.UTF_8
import java.util.zip.GZIPInputStream
import java.util.zip.GZIPOutputStream
fun gzip(content: String): ByteArray {
val bos = ByteArrayOutputStream()
GZIPOutputStream(bos).bufferedWriter(UTF_8).use { it.write(content) }
return bos.toByteArray()
@arschles
arschles / keep-cool-with-fans.go
Last active August 19, 2023 10:10
Fan-out and Fan-in with Go
package fans
// this code was inspired by https://talks.golang.org/2012/concurrency.slide#36
//
// it uses the context package (which wasn't available when that presentation was made) instead of a timer to
// do timeouts
import (
"context"
"time"
@koshatul
koshatul / README.md
Last active November 19, 2024 19:05
use Apple Keychain to store GPG Passphrases

gpg-agent setup

Need to setup gpg-agent first, on OSX I use keychain (it also does ssh-agent)

$ brew info keychain
keychain: stable 2.8.5
User-friendly front-end to ssh-agent(1)
https://www.funtoo.org/Keychain
/usr/local/Cellar/keychain/2.8.5 (7 files, 108.5KB) *