Skip to content

Instantly share code, notes, and snippets.

View cobalamin's full-sized avatar
👾

Simon Welker cobalamin

👾
View GitHub Profile
import matplotlib.pyplot as plt
class Paper(object):
def __init__(self, force_inline=True):
from copy import copy
self.orig_rc = copy(plt.rcParams)
self.force_inline = force_inline
def __enter__(self):
if self.force_inline:
@cobalamin
cobalamin / audiomgmt.sh
Created June 16, 2019 20:29
Audio management (prev/play+pause/next, volume up/down, speaker/headphone switching) via the command line
# I used the commands below not only on the command line, but also set up the aliased commands as global keyboard shortcuts.
# This can be useful if you have a keyboard that lacks media keys, or if the media keys don't behave exactly as you want them to.
# Everything below assumes PulseAudio on top of ALSA.
alias volup="amixer set 'Master' 10%+" # Using amixer because pacmd/pactl can increase beyond 100% volume, which I don't want.
alias voldn="amixer set 'Master' 10%-"
# This assumes sink port #1 and the naming of these ports. Check `pacmd list-sinks` and make adjustments if necessary.
alias outsp='pacmd "set-sink-port 1 analog-output;output-speaker' # output to speakers
alias outhp='pacmd "set-sink-port 1 analog-output;output-headphones-1' # output to headphones
@cobalamin
cobalamin / .Xmodmap
Created June 16, 2019 20:16
.Xmodmap to remap CapsLock to Alt ("Meta")
keycode 66 = Alt_L
clear Lock
@cobalamin
cobalamin / next_week.sh
Last active February 17, 2019 21:11
next_week.sh: a script for the reMarkable tablet to create a new page for my weekly planner suspend screen
#!/bin/bash
set -e
BASE_PATH="/home/root/.local/share/remarkable/xochitl"
TEMPLATE_NAME="S_Blk_screen"
SUSPEND_SCREEN_UUID="cb55aae3-6073-44a2-96ef-3f02e89d127e"
SUSPEND_SCREEN_PATH="$BASE_PATH/$SUSPEND_SCREEN_UUID"
systemctl stop xochitl
@cobalamin
cobalamin / grab_pdf.sh
Last active February 17, 2019 15:23
Download a PDF via `rclone` to the reMarkable
#!/bin/bash
set -e
# Extract some info from the given remote path
REMOTE_PATH="$1"
REMOTE_FILENAME="$(basename $REMOTE_PATH)"
REMOTE_EXTENSION="${REMOTE_FILENAME##*.}"
# Expect the filename given in the remote to end in .pdf
if [ "$REMOTE_EXTENSION" != "pdf" ]
@cobalamin
cobalamin / keybase.md
Created November 12, 2017 17:49
keybase.md

Keybase proof

I hereby claim:

  • I am cobalamin on github.
  • I am cobalamin (https://keybase.io/cobalamin) on keybase.
  • I have a public key whose fingerprint is B6BD 656D D8E6 73B1 24E9 2ACF AD89 CB1E F8FC C1FF

To claim this, I am signing this object:

@cobalamin
cobalamin / SafeInt.elm
Last active September 23, 2016 08:47
playing around with making invalid Ints represented explicitly
module SafeInt exposing (SafeInt, fromInt, get, map, map2, andThen, (+!), (-!), (*!), (//!), (%!), (^!))
type SafeInt
= Safe Int
| Invalid
fromInt : Int -> SafeInt
fromInt i =
range : number -> number -> List number
range s e =
if s < e then
rangeWith (-) (<) e s []
else
rangeWith (+) (>) e s []
rangeWith : (number -> number -> number) -> (number -> number -> Bool) -> number -> number -> List number -> List number
rangeWith modifyCount compare s e acc =
if compare s e then
module Stuff exposing (..)
import UrlParser exposing (..)
import String
import Erl
import Dict exposing (Dict)
type alias Params =
Dict String String
module FetchParallel2 exposing (..)
import Html exposing (Html, div, text, ul, li)
import Html.App exposing (program)
import Task
import Http
import Json.Decode as Json
import Json.Decode exposing ((:=))
import Dict exposing (Dict, fromList, toList)
import ZZZFetchJSON exposing (..)