Skip to content

Instantly share code, notes, and snippets.

View Soft's full-sized avatar

Samuel Laurén Soft

View GitHub Profile
struct Z {};
template <typename N>
struct S {};
template <typename A, typename B>
struct Add {};
template <typename B>
struct Add<Z, B> {
@Soft
Soft / tmux-swap-pane-with-largest.sh
Last active January 23, 2020 14:07
Swap active tmux pane with the largest pane
#!/usr/bin/env bash
tmux list-panes | awk '
BEGIN {
largest_area=0
largest_id=0
active_id=0
}
match($2, /\[([0-9]+)x([0-9]+)\]/, dim) {
area=dim[1]*dim[2]
@Soft
Soft / feedbin-scrollbars.css
Created September 28, 2019 08:52
Firefox user style for Feedbin that makes scrollbars prettier
.entry-content,
.entries,
.feeds {
scrollbar-width: thin;
}
.theme-sunset .entry-content,
.theme-sunset .entries,
.theme-sunset .feeds {
scrollbar-color: #F2EEDB #F9F7EE;
@Soft
Soft / transducers.py
Last active May 10, 2019 20:38
Clojure style transducers
#!/usr/bin/env python3
from operator import add
def map_t(fn):
def trans(reducer):
def result(acc, input):
return reducer(acc, fn(input))
CC="clang"
CXX="clang++"
LD="clang"
LDFLAGS="-fsanitize=undefined,address"
CFLAGS="-march=native -O2 -pipe -fsanitize=undefined,address -ggdb"
CXXFLAGS="${CFLAGS}"
LDFLAGS="-fsanitize=undefined,address"
FEATURES="${FEATURES} splitdebug installsources"
USE="debug"
@Soft
Soft / context-menu.patch
Created August 22, 2018 13:08
Remove "Send as Email..." options from Firefox's context menus
diff --git a/browser/base/content/browser-context.inc b/browser/base/content/browser-context.inc
--- a/browser/base/content/browser-context.inc
+++ b/browser/base/content/browser-context.inc
@@ -210,14 +210,6 @@
label="&saveImageCmd.label;"
accesskey="&saveImageCmd.accesskey;"
oncommand="gContextMenu.saveMedia();"/>
- <menuitem id="context-sendimage"
- label="&emailImageCmd.label;"
- accesskey="&emailImageCmd.accesskey;"
/* XPM */
static char *test_big[] = {
/* columns rows colors chars-per-pixel */
"64 64 3 1 ",
" c col1",
". c col2",
"X c col3",
/* pixels */
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....",
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX....",
@Soft
Soft / browse.sh
Last active August 29, 2015 14:26
Handy file browser using tmenu
function browse {
local selection=$(ls -a | tmenu -l $(tput lines))
if [[ -d "$selection" && "$selection" != "." ]]; then
cd "$selection"
browse "$(pwd)"
elif [[ -f "$selection" ]]; then
xdg-open "$selection"
fi
}
@Soft
Soft / pocket-type.css
Last active August 29, 2015 14:25
User style for Pocket
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document domain(getpocket.com) {
#page_reader p {
text-align: justify !important;
text-rendering: optimizelegibility;
-moz-hyphens: auto;
}

Keybase proof

I hereby claim:

  • I am Soft on github.
  • I am soft (https://keybase.io/soft) on keybase.
  • I have a public key whose fingerprint is 1E02 A210 80C0 C4FF 30DD B09E 71FE 86DC CB2F E7AE

To claim this, I am signing this object: