Skip to content

Instantly share code, notes, and snippets.

View troglobit's full-sized avatar

Joachim Wiberg troglobit

View GitHub Profile
@troglobit
troglobit / emacs-over-ssh
Last active September 10, 2020 10:03
Open file in Emacs over SSH
C-x C-f /sshx:amazon:
@troglobit
troglobit / howto-use-dd.md
Last active October 6, 2024 02:26
HowTo use dd to write a disk image/iso to USB on Linux

The UNIX utility dd is actually inherited from VMS, hence the opt=arg instead of --opt=arg syntax.

Here we write the input file (if) to the output file (of), using a larger block size (bs) than default (512 bytes). We'd like to see the progress of the write, this is not the default, and we want to avoid caching in the Linux VFS, so we set output flag (oflag) to direct, i.e. write-through.

sudo dd if=linuxmint-20-cinnamon-64bit.iso of=/dev/sdb bs=1M status=progress oflag=direct

Watch out, check the output file (/dev/sdb) matches your USB stick, otherwise you'll kill all the kittens!

@troglobit
troglobit / vegorecept.txt
Last active March 18, 2019 22:27
Jakobs fina vegorecept
23:01 <jakov> Båda är Jamie Oliver. Den med ärtor o linser är Daal nånting
23:01 <jakov> Den andra kallar Jamie för "Hearty Veg Curry"
23:02 <jakov> Om du tar med röd paprika så blir det kanske bättre, jag glömde köpa det :)
Ingredienser:
17:58 <jakov> 150g delade röda linser
17:58 <jakov> 150g delade gula ärtor
17:58 <jakov> 2 röd lök
17:58 <jakov> 6 klyftor vitlök
17:58 <jakov> 2 mogna tomater
@troglobit
troglobit / igmp_join.c
Last active March 17, 2019 15:07
Linux: ASM join IPv4 multicast group
/* Linux and FreeBSD: ASM join IPv4 multicast group */
#include <err.h>
#include <unistd.h>
#include <stdio.h>
#include <arpa/inet.h>
#include <net/if.h>
#include <netinet/in.h>
int main(int argc, char *argv[])
{
@troglobit
troglobit / svans.c
Last active October 17, 2018 16:14
tail in C, available under the ISC license
/*
* Copyright (c) 2018 Joachim Nilsson <[email protected]>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
/* https://gist.github.com/gdamjan/9560411 */
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <sys/timerfd.h>
#include <time.h>
#include <unistd.h>
#define handle_error(msg) \
@troglobit
troglobit / Makefile
Created February 3, 2016 23:27 — forked from wkz/Makefile
flip:
@echo '\\/' | sed -e 's:\\/://\\:'
flip-adv:
@echo '\\/' | sed -e 's/\\\//\/\/\\/'
flip-evil:
@echo "\\\\\/" | sed -e "s/\\\\\\\\\//\/\/\\\/"
@troglobit
troglobit / keybase.md
Created April 16, 2015 04:09
Keybase

Keybase proof

I hereby claim:

  • I am troglobit on github.
  • I am troglobit (https://keybase.io/troglobit) on keybase.
  • I have a public key whose fingerprint is DE09 3183 2DBF 8339 191F B2B2 2C2A B0A9 6E0C 4758

To claim this, I am signing this object:

@troglobit
troglobit / finit.conf
Last active August 29, 2015 13:59
Example Finit single configuration file for Debian
# Sample Debian finit.conf
user admin
host testbed
# Devices to fsck at boot
check /dev/vda1
# Linux kernel modules to load
module button
module evdev
@troglobit
troglobit / inadyn.json
Created February 23, 2014 21:34
Example inadyn.conf in JSON format, using Jansson.
{
"syslog": true,
"period": 600,
"startup-delay": 30,
"forced-update": 604800,
"wildcard": true,
"bind": "eth0",
"system": [
{
"type": "[email protected]",