Skip to content

Instantly share code, notes, and snippets.

View xkr47's full-sized avatar

Jonas Berlin xkr47

View GitHub Profile
@xkr47
xkr47 / README.md
Last active January 17, 2017 20:07
irssi keybindings for switching between up to 999 windows

irssi keybindings for switching between up to 999 windows

Use these keybindings to access up to 999 windows using at most 4 keys:

alt-0 .. alt-9 -> windows 0..9 (standard keybindings)
alt-q 0 .. alt-q 9 -> windows 10..19
alt-w 0 .. alt-w 9 -> windows 20..29
...
alt-p 0 .. alt-p 9 -> windows 90..99
alt-a 0 0 .. alt-a 0 9 -> windows 100..109

Keybase proof

I hereby claim:

  • I am xkr47 on github.
  • I am xkr47 (https://keybase.io/xkr47) on keybase.
  • I have a public key ASAdU_1qct6ysfYXrUMHiqUK2K56kgS3YnExyhUfI1cYHgo

To claim this, I am signing this object:

@xkr47
xkr47 / README.md
Last active August 9, 2018 09:31
Using IntelliJ UI Designer for creating Swing forms in the Ceylon (1.3.0) language

I wanted to create a Swing app in Ceylon and figured I'd give using the UI designer a shot. Here are the necessary steps to get it to work:

Steps

Change IDEA settings

  • From the menu: File -> Settings
  • Navigate to Editor / GUI designer
  • Make sure "Generate GUI into:" has Java source code selected
  • Change "Default accessibility for UI-bound fields:" is something else than "private", for example package-private
  • Click OK to save
var gulp = require('gulp');
var util = require('gulp-util');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var through2 = require('through2');
var plumber = require('gulp-plumber');
var errs = 0;
gulp.task('default', function () {
@xkr47
xkr47 / README.md
Last active September 28, 2017 07:59
git tweak-index - tweak/edit files in index without touching the checked out versions

git tweak-index

This git add-on command lets you tweak/edit files in the index/stage directly without touching the checked out working copy.

  • Use case 1: So you accidentally git-added some changes that you didn't want to merge just yet and would like to partially undo?
  • Use case 2: You want to make a quick commit to some file(s) but keep the checked out version(s) as-is?
  • Use case 3: You have been trying to use git reset -p but failed spectacularly?
  • Use case 4: You want to stage something that is not an interpolation of the checked out and the committed version?

Installation

@xkr47
xkr47 / README.md
Last active February 16, 2016 23:46
PHP serialized object format <-> YAML converter

These scripts convert PHP serialized object format e.g.

a:2:{i:2;a:4:{s:5:"title";s:5:"Hello";s:5:"count";i:0;s:12:"hierarchical";i:0;s:8:"dropdown";i:0;}s:12:"_multiwidget";i:1;}

to YAML format:

---
2:
  title: Hello
  count: 0
@xkr47
xkr47 / README.md
Last active February 14, 2016 08:15
Git subcommand for moving/renaming paths using sed/perl expressions

Save file as git-mvs in your path and then:

find -name '*file' -print0 | xargs -r0 git mvs 's/foo/bar/g'

or in zsh:

git mvs 's/foo/bar/g' **/*file
@xkr47
xkr47 / dressed_up.ceylon
Last active February 2, 2016 09:23
Ceylon Web Runner: dressed_up.ceylon
shared dynamic MyInterface {
shared formal String foo;
}
shared void run() {
dynamic {
console.log("-----");
dynamic dyn = eval("({foo: 'bar'})");
console.log(dyn);
MyInterface my = eval("({foo: 'bar'})");
@xkr47
xkr47 / getKeyEventRawCode.ceylon
Last active January 28, 2016 19:58
How to get the private rawCode field out of a Java Swing KeyEvent
import java.awt.event {
KeyEvent
}
import java.lang {
Runnable,
JBoolean=Boolean,
JLong=Long
}
import java.lang.reflect {
Field