Skip to content

Instantly share code, notes, and snippets.

View oz's full-sized avatar
💀
not today

Arnaud Berthomier oz

💀
not today
View GitHub Profile
@oz
oz / log.md
Created December 12, 2022 19:37

Let's encrypt stuff with openssl

$ uname -a
Linux polaris 6.0.10-arch2-1 #1 SMP PREEMPT_DYNAMIC Sat, 26 Nov 2022 16:51:18 +0000 x86_64 GNU/Linux
$ echo hello ssl > file.txt
$ openssl enc -aes-256-cbc \
  -pass pass:1234567890abcdefgijklmnopqrstuvwxyz \
  -in file.txt -out file.enc
*** WARNING : deprecated key derivation used.
Setting up linux-firmware (1.187.8) ...
update-initramfs: Generating /boot/initrd.img-5.4.0-62-generic
I: The initramfs will attempt to resume from /dev/dm-2
I: (/dev/mapper/vgkubuntu-swap_1)
I: Set the RESUME variable to override this.
Error 24 : Write error : cannot write compressed block
E: mkinitramfs failure cpio 141 lz4 -9 -l 24
update-initramfs: failed for /boot/initrd.img-5.4.0-62-generic with 1.
dpkg: error processing package linux-firmware (--configure):
installed linux-firmware package post-installation script subprocess returned error exit status 1
#!/bin/sh
SESSIONNAME="pim"
tmux has-session -t $SESSIONNAME > /dev/null
if [ $? != 0 ]; then
tmux new-session -s $SESSIONNAME -n mail -d
# Start mutt
tmux send-keys -t $SESSIONNAME "sleep 1" C-m
tmux send-keys -t $SESSIONNAME "TERM=screen-256color-bce neomutt" C-m
@oz
oz / get-out-of-done.rb
Created February 11, 2013 18:48
A quick and dirty hack to remove yourself from Trello cards that belong to a "done" column. This is quite useful if you're using Trello as a scrum-like board, but don't want to receive notifications when someone else picks up the card. The script is originally from @shakaman, so go and thank him. Meanwhile, fork to your heart's content!
#!/usr/bin/env ruby
# encoding: UTF-8
require 'rest_client'
require 'yajl'
@api = RestClient::Resource.new('https://api.trello.com/1')
@key = 'API_KEY'
@token = 'OAUTH_TOKEN'
@login = 'YOUR_LOGIN'
@oz
oz / upgradepg.md
Created December 19, 2014 15:21
Upgading from PG 9.3 to PG 9.4 on Mac OS X, with Homebrew

Brew upgrade...

Run the usual brew update, and brew upgrade to get the latest 9.4 version of PostgreSQL.

After upgrading PG from 9.3 to 9.4 with brew, the server will not start as is. If you value your database contents, and configuration, pg_upgrade is here to migrate those.

Do not delete the old binaries at once: do not run brew cleanup, because you need 9.3 binaries to migrate.

Migration

@oz
oz / stock.hs
Created August 16, 2013 09:09
Playing with Yahoo's stock API in Haskell, use this little program to quickly check stock prices, or change currencies.
import Prelude
import System.Environment
import Network.HTTP
import Control.Monad
showUsage :: IO ()
showUsage = do
putStrLn "Usage: stock <options...>\n"
putStrLn " - get a quote: stock <symbol>"
putStrLn " - change money: stock <from> <to> <amount>"
onchange () {
while inotifywait --exclude .swp -e modify -r .
do
$@
done
}
@oz
oz / octokit-wat.rb
Created May 19, 2016 15:20
Not sure if... ¬¬
client = Octokit::Client.new(...)
repo = client.repo('oz/osdb')
repo[:owner].class # => Sawyer::Resource
repo.to_h[:owner].class # => Sawyer::Resource
repo.to_hash[:owner].class # => Sawyer::Resource
repo.to_attrs[:owner].class # => Hash
@oz
oz / tmux.conf
Created December 20, 2010 15:00
My tmux.conf as of 2010/20/12
# General config:
# ---------------
setw -g utf8 on
set -g lock-after-time 1800
set-window-option -g automatic-rename off
set -g default-terminal screen
# Look & feel:
# ------------
# Panes colors
@oz
oz / macro-reformat
Created October 1, 2013 16:30
A mutt macro to reformat e-mail message bodies. This is especially useful when you receive e-mails with very long lines of text, and you'd rather read a neatly formatted text. Simply press `Esc-f` to toggle between original message body, and reformatted with `par`.
# Add a macro on Esc-f to toggle message body filtering with par (reformat).
macro pager ,@fmton \
"<enter-command>set display_filter=/usr/bin/par<enter> \
<enter-command>macro pager \\ef ,@fmtoff 'Unformat message body'<enter> \
<exit><display-message><enter>" \
"Unformat message body"
macro pager ,@fmtoff \