Skip to content

Instantly share code, notes, and snippets.

@jc00ke
jc00ke / nginx-config-auth-cert-ssl.md
Created July 14, 2022 20:04 — forked from alexishida/nginx-config-auth-cert-ssl.md
Tutorial to configure Nginx client-side SSL certificates.
View nginx-config-auth-cert-ssl.md

Client-side SSL

For excessively paranoid client authentication.

Original: https://gist.github.com/mtigas/952344

Convert SSL certificate from CRT format to PEM

openssl x509 -in server.crt -out server.der -outform DER
openssl x509 -in server.der -inform DER -out server.pem -outform PEM
@jc00ke
jc00ke / Convert PostgreSQL to SQLite
Created July 5, 2022 16:17 — forked from fiftin/Convert PostgreSQL to SQLite
Convert PostgreSQL to SQLite
View Convert PostgreSQL to SQLite
1. Dump the data only sql to file
$ pg_dump --data-only --inserts YOUR_DB_NAME > dump.sql
2. scp to local
3. Remove the SET statements at the top
such as:
SET statement_timeout = 0;
SET client_encoding = 'SQL_ASCII';
4. Remove the setval sequence queries
View logseq_install_and_update.sh
#!/usr/bin/env bash
set -ex
trap 'handleError' ERR
handleError() {
echo ""
echo "If you encountered an error, please consider fixing"
echo "the script for your environment and creating a pull"
@jc00ke
jc00ke / firefox-snap-to-deb.sh
Last active October 21, 2022 03:55
Migrate Firefox from snap back to deb on Ubuntu Jammy+
View firefox-snap-to-deb.sh
#!/bin/env bash
sudo snap remove firefox
sudo add-apt-repository ppa:mozillateam/ppa
echo '
Package: *
Pin: release o=LP-PPA-mozillateam
Pin-Priority: 1001
' | sudo tee /etc/apt/preferences.d/mozilla-firefox
@jc00ke
jc00ke / gist:078cbe23ac56e76ee0a8ee64523b62dc
Created May 25, 2022 19:34
Migrate apt-key to keyrings file
View gist:078cbe23ac56e76ee0a8ee64523b62dc
> 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
View elm-watcher.sh
#!/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 / 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
View Ubuntu default sound input and output.md

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
View unicode-format.txt
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
View 50unattended-upgrades
// 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
View debug-ooo.js
// 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';