Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
# Downloads, compiles and installs qBittorrent.
# The qBittorrent version to download
version=$1
# The libtorrent-rasterbar version to download
lt_version="1.1.11"
# ./configure arguments for qBittorrent
configure_args="--disable-gui"
@mkroman
mkroman / Network.cpp
Created November 17, 2011 01:42
Uncrustify configuration inspired by Google's C++ styleguide.
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <unistd.h>
#include <string.h>
#include <iostream>
#include <stdarg.h>
#include <stdio.h>
@mkroman
mkroman / op-env.sh
Last active June 2, 2022 02:27
Prepare a shell environment with help from a 1Password vault
# Prepare a shell environment with help from a 1Password vault
#
# Prepares a shell environment by reading the `script` field from an item with
# the given NAME inside the `Environments` vault and then evaluating it in the
# current shell after injecting 1Password references.
#
# Usage:
#
# op-env <NAME>
#
@mkroman
mkroman / pupdiff
Created August 2, 2021 01:37
Simple script that fetches a page and extracts a css selector element and compares it with a cached version
#!/usr/bin/env bash
#
# This is a simple script that fetches the page from a given url and extracts a
# specific element using a CSS selector and compares it with the last invocation
# of this command with the same arguments.
#
# Some requests might not actually be HTML, but pup will parse it as HTML as if
# it had a body regardless, so one can still use the "body" css selector for
# non-html files.
#
… tons of calls
prlimit64(0, RLIMIT_AS, {rlim_cur=150000000, rlim_max=307200*1024}, NULL) = 0
futex(0x7f5171126048, FUTEX_WAKE_PRIVATE, 2147483647) = 0
statx(0, NULL, AT_STATX_SYNC_AS_STAT, STATX_ALL, NULL) = -1 EFAULT (Bad address)
statx(AT_FDCWD, ".", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_ALL|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFDIR|0755, stx_size=4096, ...}) = 0
statx(AT_FDCWD, "servers", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_ALL|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFDIR|0755, stx_size=4096, ...}) = 0
statx(AT_FDCWD, "servers", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_ALL|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFDIR|0755, stx_size=4096, ...}) = 0
openat(AT_FDCWD, "servers", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 3
newfstatat(3, "", {st_mode=S_IFDIR|0755, st_size=4096, ...}, AT_EMPTY_PATH) = 0
#!/usr/bin/env python
# This scripts generates and makes changes to `compile_commands.json` in order
# to make it work with coc-clangd without throwing a fit
import os
import json
import shlex
import subprocess
project_root = os.path.join(os.path.dirname(__file__), '..')
mk@… ~/Projects/Sandbox % cat digest-sha256-file-vs-system-sha256sum.rb
#!/usr/bin/env ruby
require 'tempfile'
require 'digest/sha2'
require 'benchmark/ips'
file = Tempfile.new 'testfile'
file.write 'a' * 1024 * 1024 * 2
### Keybase proof
I hereby claim:
* I am mkroman on github.
* I am mkn (https://keybase.io/mkn) on keybase.
* I have a public key ASCrhe5_SFps_vD4R2FymT1GO4FaLiem42hHRIyuPtDFGgo
To claim this, I am signing this object:
@mkroman
mkroman / fish.rb
Created December 17, 2015 14:46
A bunch of scripts I once made for weechat
# the oh-so-famous fish encryption for weechat.
# Copyright (C) 2010, Mikkel Kroman <mk@maero.dk>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@mkroman
mkroman / GPG Capabilities.md
Last active July 9, 2018 07:02
GPG key capabilities and usage meanings

Signing is signing data (i.e. gpg --sign the_file)

Certification is signing a key (i.e. gpg --sign-key the_key)

Authentication is signing a challenge (like ssh does). The Authentication stuff can be used to log in to a machine using your GPG key.

The signature math is the same however you do it. The key usage flags are just to classify things.