Skip to content

Instantly share code, notes, and snippets.

@jc00ke
jc00ke / gist:078cbe23ac56e76ee0a8ee64523b62dc
Created May 25, 2022 19:34
Migrate apt-key to keyrings file
> sudo apt-key list
# find last 8 of public signature, for example ABCD EFGH for jc00ke
> sudo apt-key export ABCDEFGH | sudo gpg --dearmour -o /usr/share/keyrings/jc00ke.gpg
> sudo -H gedit /etc/apt/sources.list.d/jc00ke.list
# add [arch=amd64 signed-by=/usr/share/keyrings/jc00ke.gpg] after deb
> sudo apt update
> sudo apt-key del ABCDEFGH
# summarized from https://askubuntu.com/a/1403964
#!/usr/bin/env bash
# https://discourse.elm-lang.org/t/simple-watcher-for-elm-make/3694
# https://twitter.com/evancz/status/1131650856024125440
# nice colors
COLOR_OFF="\e[0m";
DIM="\e[2m";
# random filename for the lock; see below
@jc00ke
jc00ke / op-gpg
Created September 26, 2020 19:44
Import 1Password's GPG key on Ubuntu
#!/usr/bin/env bash
# Necessary to use the MIT keyserver on Ubuntu 20.04/Regolith 1.4 with gpg
gpg --keyserver hkp://pgp.mit.edu --recv-keys 3FEF9748469ADBE15DA7CA80AC2D62742012EA22
@jc00ke
jc00ke / Ubuntu default sound input and output.md
Created November 18, 2021 19:22 — forked from ChriRas/readme.md
Set up default audio device on Ubuntu 20.04 LTS

Problem

I have a notebook connected to a port replicator. I want to use the build-in speakers and microfone and not the external ones. If I boot my notebook in my port replicator Ubuntu changes the devices to external.

Solution

  1. Find your internal speaker
pactl list short sinks
@jc00ke
jc00ke / unicode-format.txt
Created November 10, 2021 05:46
Very nice formatting
protocol://username:password@host:port/name
═══╦════ ═══╦════ ═══╦════ ═╦══ ═╦══ ═╦══
║ ║ ║ ║ ║ ╚╡► Database-dependent
║ ║ ║ ║ ╚═════╡► Port number
║ ║ ║ ╚══════════╡► Hostname
║ ║ ╚═════════════════╡► Password
║ ╚══════════════════════════╡► Username
╚═════════════════════════════════════╡► Database-dependent
Yanked from https://deploy-docs.aptible.com/docs/database-credentials
// Automatically upgrade packages from these (origin:archive) pairs
//
// Note that in Ubuntu security updates may pull in new dependencies
// from non-security sources (e.g. chromium). By allowing the release
// pocket these get automatically pulled in.
Unattended-Upgrade::Allowed-Origins {
"${distro_id}:${distro_codename}";
"${distro_id}:${distro_codename}-security";
// Extended Security Maintenance; doesn't necessarily exist for
// every release and this system may not have it installed, but if
@jc00ke
jc00ke / debug-ooo.js
Last active August 11, 2021 17:31
Google AppScript to add personal calendar OOO events to a shared OOO calendar automatically
// USE THIS FOR DEBUGGING
// It doesn't import to a calendar, which uis very convenient when dealing
// with recurring events that can muddy up the shared calendar.
// Set the ID of the team calendar to add events to. You can find the calendar's
// ID on the settings page.
var TEAM_CALENDAR_ID = 'ENTER_TEAM_CALENDAR_ID_HERE';
// Set the email address of the Google Group that contains everyone in the team.
// Ensure the group has fewer than 500 members to avoid timeouts.
var GROUP_EMAIL = 'ENTER_GOOGLE_GROUP_EMAIL_HERE';
@jc00ke
jc00ke / ts-ip-by-hostname.sh
Last active July 28, 2021 17:24
Tailscale IP address by hostname with jq
#!/bin/env bash
set -o pipefail
read -r -d '' HELP <<-'HELPDOC'
ts-ip-by-hostname — returns the Tailscale IP address of a connected
device by the hostname.
Usage:
@jc00ke
jc00ke / README.md
Created June 25, 2021 18:11 — forked from reegnz/README.md
Implementing a jq REPL with fzf

Implementing a jq REPL with fzf

Update: I created jq-zsh-plugin that does this.

One of my favourite tools of my trade is jq. It essentially enables you to process json streams with the same power that sed, awk and grep provide you with for editing line-based formats (csv, tsv, etc.).

Another one of my favourite tools is fzf.

@jc00ke
jc00ke / application_helper.rb
Created May 9, 2011 23:37
Stubbing controller_name & action_name in Rails 3 with rspec 2.5
module ApplicationHelper
def foo
controller_name == 'widgets' && action_name == 'index'
end
end