Skip to content

Instantly share code, notes, and snippets.

@meonkeys
meonkeys / taskd.service
Created January 16, 2020 18:07
systemd unit for taskwarrior taskd
[Unit]
Description=Secure server providing multi-user, multi-client access to task data
After=network.target
Documentation=http://taskwarrior.org/docs/
[Service]
ExecStart=/usr/bin/taskd server --data /var/lib/taskd --log=-
Restart=on-abort
Type=simple
User=Debian-taskd
@meonkeys
meonkeys / apt-fails.txt
Created April 27, 2018 06:25
apt broken after upgrade from ubuntu 16.04 to 18.04
# can boot to a command line
# GUI doesn't work
# wireless works
$ sudo apt-get -f install
Reading package lists...
Building dependency tree...
Reading state information...
Correcting dependencies... failed.
The following packages have unmet dependencies:
@meonkeys
meonkeys / free.txt
Created January 3, 2018 01:34
Output format changed for the `free` command.
Two different machines. The first has 8GiB RAM and is running Ubuntu 14.04, the 2nd has
16GiB RAM and is running Ubuntu 16.04. Looks like they changed the output format for `free`.
ubuntu 14.04 $ free -m
total used free shared buffers cached
Mem: 7867 1077 6790 1 227 470
-/+ buffers/cache: 380 7487
Swap: 8073 0 8073
@meonkeys
meonkeys / user.md
Last active November 11, 2017 07:26
Run a container as a host user/group

Say I have a short-lived container that creates a file inside an attached volume. Most off-the-shelf images run stuff as root in containers, so unless I do extra stuff in the container the file ends up owned by root on the host. I want that file owned by me.

Run container as specific user

docker run has a --user argument that allows forcing a specific uid/gid of the first process started in the container. This seems to work in some cases. For example:

host$ mkdir dockTmp
host$ docker run -u $UID:$(id -g) -v $(pwd)/dockTmp:/tmp/dockTmp --rm -it ubuntu:16.04 /bin/bash
groups: cannot find name for group ID 1000
@meonkeys
meonkeys / log.txt
Created April 23, 2017 21:28
log test
if (1) { console.log("Hello");}
if (1) { console.log("Hello");}
@meonkeys
meonkeys / rainbow-banner.sh
Last active February 26, 2017 21:53 — forked from anonymous/rainbow-banner.sh
Use toilet to make a colorful banner in the console. Exercise for the reader: use first command-line argument as the banner text!
#!/bin/bash
while IFS= read -r -n1 char
do
clear
all="${all:-}$char"
toilet -t -F gay -f smmono12.tlf "$all"
sleep 0.25
done <<< 'Programming!'
@meonkeys
meonkeys / generateIndexCreationCommands.js
Last active January 18, 2017 23:33
Generate MongoDB index creation commands from the console
// Reads indexes from a running db and prints out commands to create those
// indexes in another db, for use in those cases where you restored a dump with
// --noIndexRestore.
// Just copy & paste into the MongoDB shell.
db.getCollectionNames().forEach(function(collection) {
var cleanIndexesBesidesId = [];
var indexes = db.getCollection(collection).getIndexes();
indexes.forEach(function(i) {
if (i.name === '_id_') {

Keybase proof

I hereby claim:

  • I am meonkeys on github.
  • I am meonkeys (https://keybase.io/meonkeys) on keybase.
  • I have a public key whose fingerprint is D800 2DF2 8E00 B0E7 66F6 9BF8 9B5D 993F 836F 29C0

To claim this, I am signing this object:

@meonkeys
meonkeys / web-servers.md
Last active August 29, 2015 14:23 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000