Skip to content

Instantly share code, notes, and snippets.

View bhaak's full-sized avatar

Patric Mueller bhaak

View GitHub Profile
@bhaak
bhaak / irc-vorleser.rb
Created May 11, 2012 11:33
simple irc2speech script
# Gemfile:
# source "http://rubygems.org"
# gem "espeak-ruby"
# gem "cinch"
# gem "cld"
require 'rubygems'
require 'bundler/setup'
require 'espeak-ruby'
package com.github.bhaak;
import java.net.URI;
import com.amazon.kindle.booklet.AbstractBooklet;
import com.amazon.kindle.booklet.BookletContext;
import com.amazon.kindle.booklet.ChromeException;
import com.amazon.kindle.booklet.ChromeHeaderBar;
import com.amazon.kindle.booklet.ChromeHeaderRequest;
import com.amazon.kindle.booklet.ChromeSearchBarRequest;
<translation lang="de">
<bla>
<blubb>
<info>
<snafu>Alles putt!</snafu>
</info>
</blubb>
</bla>
<error>
<no_space>Kein Platz mehr auf dem Geraet links</no_space>
class Object
def ∈(enumerable)
enumerable.include? self
end
def ∉(enumerable)
!∈(enumerable)
end
end
array = [1,2,3]
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <termios.h>
#include <fcntl.h>
#define EXIT_FAILURE 1
int
check_utf8() {
@bhaak
bhaak / gist:4e6e2ebb66ad16b4acd4aba81e50729d
Last active July 15, 2018 13:24
faster implementations of Rails' number_to_currency with hard coded formatting options
def fast_number_to_currency number
fix = number.fix
frac = number.frac.abs
"#{fix.to_i.to_s.gsub(/(\d)(?=(\d\d\d)+(?!\d))/, "\\1'")}#{('%.2f' % frac)[1..-1]}"
end
def faster_number_to_currency1 number
integer = (number * 100).to_i
sign = integer.positive? ? '' : '-'
positive = integer.abs
#!/bin/bash
SOCKET=/tmp/tmux-1001/default
WINDOW=`tmux -S $SOCKET list-panes -F '#I'`
WINDOW=69
function black_window {
tmux -S $SOCKET rename-window -t:$WINDOW ' '
tmux -S $SOCKET set-window-option -t:$WINDOW window-status-fg black
git clone https://github.com/bebbo/amiga-gcc
cd amiga-gcc/
sudo mkdir /opt/amiga
sudo chown `id -un`:`id -gn` /opt/amiga
make update
grep all: Makefile | cut -d : -f 2 - | sed 's/ gdb //' | xargs make
root = true
[*]
charset=utf-8
end_of_line=lf
insert_final_newline=false
indent_style=space
indent_size=4
trim_trailing_whitespace = true
max_line_length=78
$ clang -dM -E - < /dev/null |grep clang
#define __VERSION__ "4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.1)"
#define __clang__ 1
#define __clang_major__ 9
#define __clang_minor__ 1
#define __clang_patchlevel__ 0
#define __clang_version__ "9.1.0 (clang-902.0.39.1)"