Skip to content

Instantly share code, notes, and snippets.

View drdaxxy's full-sized avatar

Niklas K. drdaxxy

  • Hannover, Lower Saxony, Germany
View GitHub Profile
@drdaxxy
drdaxxy / google_reader_to_instapaper.rb
Created November 12, 2011 15:50
Export Google Reader notes to Instapaper (from better source than gist.github.com/1331457 )
# Ruby script for exporting your Google Reader notes to Instapaper
# Uses the more reliable personal note Atom feed (other script I've seen uses a JSON file from Reader's export page, which often doesn't include links)
# Almost no failsafes, rate limit might be hit, so use at your own risk
# Outputs URLs and titles of notes that couldn't be submitted (shamelessly copied from gist.github.com/1331457 )
require 'rss'
require 'net/http'
## Config
notes_atom_feed = '' # log into Reader and save the feed from www.google.com/reader/atom/user/-/state/com.google/created?n=INSERT_NUMBER_OF_NOTES somewhere (n is item limit, I used something like 10000, just to be sure :P)
instapaper_username = ''
@drdaxxy
drdaxxy / indicator-power-show-percentage.diff
Created September 9, 2013 02:37
Quick hack for Ubuntu 12.04's https://launchpad.net/indicator-power showing remaining percentage of battery charge instead of time. This is already implemented in newer versions.
diff -Naur a/data/com.canonical.indicator.power.gschema.xml.in b/data/com.canonical.indicator.power.gschema.xml.in
--- a/data/com.canonical.indicator.power.gschema.xml.in 2012-04-11 16:58:56.000000000 +0200
+++ b/data/com.canonical.indicator.power.gschema.xml.in 2013-09-09 04:29:40.921738433 +0200
@@ -5,10 +5,10 @@
<value nick="never" value="2" />
</enum>
<schema gettext-domain="@GETTEXT_PACKAGE@" id="com.canonical.indicator.power" path="/com/canonical/indicator/power/">
- <key name="show-time" type="b">
+ <key name="show-percentage" type="b">
<default>false</default>
@drdaxxy
drdaxxy / cobra_trace.txt
Created November 4, 2014 13:14
Cobra (obfuscator.uk) in Xdebug. Deobfuscated code is at the bottom of the full file.
This file has been truncated, but you can view the full file.
TRACE START [2014-11-04 13:07:36]
0.0030 231592 -> explode() /var/www/cobra.php:3
0.0031 237768 -> eval('return strrev(base64_decode(\'KGVkb2NlZF80NmVzYWIoZXRhbGZuaXpnKGxhdmU=\'));') /var/www/cobra.php:3
0.0031 237928 -> base64_decode() /var/www/cobra.php(3) : eval()'d code:1
0.0032 237928 -> strrev() /var/www/cobra.php(3) : eval()'d code:1
0.0033 247896 -> eval('eval(gzinflate(base64_decode(\'PVjbkqs6kv2XjnnoE/WwURV22dExDxJIgFxcJEBcJiYmbMACIxv2MVVcvn7kHdH9vpxkpjJzreXm56z+eTk/m735f3VTDXXzz/8quu+Hlxaf+wtqv9ug8MLj/5j/+9df/2pe4Hq6938P+/0H2P3zH5g/T25fJ4zQOseHD0tJfO6fLktwwsX0O5EMn5ComB2EkJSTTY6Xr7ZCKDtSBvp/4x1+03gyvvCuxpfxTeMh0fjp/B+8kho/Q423mK3xs9L4lGh8zbcXHmn8M9B4CO//xhuhxtts03gJNL5yNL7hf/L5E7/UeIIcjYcvvBIaj8krf/WKD6nGF+yVj3rl/4w03oYv/Dxr/BC98H/iq1LjRf6Kj1/5zJPGt6/40P6Tz6s/T/Sf+OJVbwpf+D/1suAVP9R4S7zik+HVn1f+bvKql7z6KcSf/HV8Xfarn5XGY/v9SLliGr+kBA1X0Q+fJzixHAqcWNLDBlL2Oz8mgh341pqpaFNmFedTO1UXY7q6PPVfv60BhSgxsW/teNkrRLd0daS6Z0zc8gVUDpgtYUw43OrGkuQb8cV
//TODO: there's a bug where after around 10 minutes, the text thing just barfs out like all the previous texts in the past 3 minutes multiple times..
//WHY WHY.. I think set interval is to blame or something.asdklfjasdkl;vnh
//or just say, if there's an overflow, don't write out the textaskl;djfasdkl;f
nicoNicoTwitch = function(){
var helper = {
//min inclusive, max exclusive
getRandomInt: function(min, max) {
return Math.floor(Math.random() * (max-1 - min + 1) + min);
},
@drdaxxy
drdaxxy / Bottom powerline
Created April 24, 2015 21:39
.bashrc snippet for bottom powerline with history prompt replacement
preexec () {
# delete old prompt; one "\e[1A\e[K" per line of $PS1
for (( i=0, l=$(echo -e $PS1 | wc -l) ; i < l ; i++ ))
do
echo -ne "\e[1A\e[K"
done
# replacement for prompt
echo -ne "\e[37;2m[`date +"%Y-%m-%d %k:%M:%S"`] \e[0m"
echo -ne "\e[31;1m$USER@$HOSTNAME:$2$ \e[0m"
echo -n "$1"
input_img = PIL.Image.open('/home/niklas/interstellar/0465.png')
output_img = input_img
for i in xrange(465, 1100):
old_input_img = input_img
input_img = PIL.Image.open('/home/niklas/interstellar/%04d.png' % i)
output_img = Image.composite(output_img, input_img, ImageEnhance.Brightness(ImageOps.grayscale(compare_images(old_input_img, input_img, 10))).enhance(0.1))
frame = deepdream(net, np.float32(output_img), end='pool5', iter_n=10, octave_n=2)
output_img = PIL.Image.fromarray(np.uint8(frame))
output_img.save('/home/niklas/interstellar/out/%04d.png' % i)
@drdaxxy
drdaxxy / twitchinstallstitleupdate.js
Last active November 1, 2015 15:50
Updates stream title for Twitch Installs Arch Linux whenever a new command is entered. Lets you see the last command without having to watch chat, or wait for the stream to catch up. Instructions: Wait for chat to load, open javascript console (e.g. hit F12 then click Console in Chrome), copy-paste this and hit enter.
$(".chat-lines").first().bind('DOMNodeInserted', function(event) {
if($(event.target).find(".from").text() == "TwitchInstallsArchLinux") {
var message = $(event.target).find(".message").text();
if(message.startsWith("Winning")) {
$("#broadcast-meta > .info > .title")
.hide()
.text((new Date()).toLocaleTimeString("en-GB") + " - " + message)
.css("background-color", "red")
.fadeIn(1000).dequeue()
.animate({ backgroundColor: "white" }, 1000);
$script = <<SCRIPT
function randpw(){ < /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-16};echo;}
MYSQL_PASSWORD=$(randpw 16)
# TODO: actually create and use cgroups for IDE and db/pma/app servers
sudo apt-get -y update
sudo DEBIAN_FRONTEND=noninteractive apt-get -y install cgroup-bin
sudo cgroups-mount
@drdaxxy
drdaxxy / sg0_sprite_assembler.py
Last active May 23, 2019 22:08
MAGES. engine sprite assembler. I didn't write this.
#!/usr/bin/env python3
# Steins;Gate 0 Sprite Assembler v0.4
# Assembling sprites using their definitions in LAY files.
# Author: Nimms <nimms@ya.ru>
# 0.4 + edit by DrDaxxy
# support little endian files (Windows builds)
# 0.4:
# [FIX] wildcards: previously evaluation only occured for the last argument;
@drdaxxy
drdaxxy / unlay.py
Last active November 5, 2016 21:59
MAGES. engine sprite definition (.LAY) decoder. I didn't write this.
#!/usr/bin/env python3
# unlay: represent LAY file in a human readable form.
# Author: Nimms <nimms@ya.ru>
# edited by DrDaxxy to support little endian files (Windows builds)
import sys
import struct
import codecs