Skip to content

Instantly share code, notes, and snippets.

@jaseg
jaseg / gist:3265917
Created August 5, 2012 17:00
Minecraft World Generator

This is a small line of bash to coax a Minecraft server into generating a large rectangular piece of the world. To use it, the Minecraft server first needs to be stopped and your inventory needs to be placed in some chest. That being done, start the server with the following line (after you replaced "jaseg" with your nick):

(sleep 3m;
  echo "/gamemode creative jaseg";
  for x in $(seq 0 192 3200); do
    for z in $(seq 0 192 3200); do
      echo "/tp jaseg $x 128 $z";
      sleep 60s;
 done;
@jaseg
jaseg / gist:3334991
Created August 12, 2012 22:32
Password manager without a password manager

Prelude

Since password managers are big and complicated and I currently am pretty bored since I am sitting in a car for a few hours, here is a simple algorithm to generate resource-specific, unique passwords using a master password and no password database.

WARNING

As pointed out here: http://news.ycombinator.com/item?id=4374888 this method is broken.

Usage

@jaseg
jaseg / README.md
Created August 27, 2012 10:10
Windows XP as your screensaver!

Windows XP as your screensaver!

Overview

When xscreensaver starts screen saving, instead of a boring screen saver it spawns a small shell script. This shell script starts a new X server with a very minimal awesome window manager and unfreezes a kvm virtual machine containing a Windows XP on that X server, ready to be used by any passersby. To unlock the screen, you need to switch back to the VT where your usual X is running. As soon as the screen is unlocked, xscreensaver sends a SIGTERM to the shell script which in turn stops all the X servers, window managers and virtual machines it launched and resets the VM image. Should the VM exit before the screen is unlocked because somebody pressed "Shut down" the VM image is reset and the VM restarted.

Setup

@jaseg
jaseg / README.md
Last active December 14, 2015 11:08
Greet your shell users like they were Kim Jong-il!

Put the following line in /etc/profile and put the attached titles file in /etc/.

echo Welcome `id -un`, `sort -R</etc/titles|head -n 1`!

The next time someone logs in, there will be an appropriate greeting:

/home/jaseg
&lt;3 ssh kim@my-awesome-server.example.net
@jaseg
jaseg / gist:5296519
Last active March 23, 2016 10:08
zsh unicode table using only zsnexpn(1) in <140 characters

The following line produces a unicode table (decimal value and unicode characters) using only zsh * expansion, * substitution and the print-builtin.

setopt extendedglob histsubstpattern multibyte
print -ac ${${(A)=u::={5126..5743}}:s/#%(#b)(*)/'${(r:6:m)match[1]}${(#mr:4:)match[1]}'/}

Output:

@jaseg
jaseg / gist:8314578
Created January 8, 2014 10:14
sed script to put `quoted strings` in text in {braces}

:0;s/`/{/;s/`/}/;t0

Because sed does more than just s///

@jaseg
jaseg / setkeyboard
Last active January 3, 2016 00:48
My xkb setup
#!/bin/bash
# Remaps [TAB] to mean [ESCAPE] (nice for vim) and properly assigns the "Windows
# key" to MOD4 (nice for the awesome window manager)
# Also, sprinkles some unicode over unused or poorly used keys.
# <LGST> is that key next to left shift that is not found on US keyboards
xkbcomp - $DISPLAY<<EOF
xkb_keymap {
xkb_keycodes { include "evdev+aliases(qwertz)"};
xkb_types { include "complete"};
xkb_compat { include "complete"};
@jaseg
jaseg / README.md
Last active March 26, 2024 14:21
Convert openldap .schema files to .ldif files

This is old!

Hey there,

occassionally, people still seem to stumble across this script because it seems it shows up in some search results. Please be aware that I made this script ten years ago, and by now, there is probably a better way to achieve the same result.

Have a nice day!

Which thinkpad should I buy?

New Kbd Old Kbd
Small X230/X230t X220/X220t
Large T430/T430s T420/T420s
Station W530 W520/W510

#40 series (T440, X240, W540, etc)

@jaseg
jaseg / README.md
Created April 28, 2014 10:55
systemd service file for running a transmission-daemon through OpenVPN

What is still missing

  • mullvad-up.sh as called from openvpn.conf would be unnecessary if openvpn would fork after setting up the tun interface, for then its contents could be realized with a few systemd ExecStartPost-directives.
  • Some means of automatically detecting and stopping/reconnecting a broken connection would be nice.
  • Due to libcurl being buggy, transmission-daemon leaks DNS requests. I don't mind, if you do, consider using a couple of iptables rules to route any packets coming from transmission's UID through a special routing table.