Skip to content

Instantly share code, notes, and snippets.

View bxt's full-sized avatar

Bernhard Häussner bxt

View GitHub Profile
@bxt
bxt / php-doc.mkd
Created March 6, 2011 23:59
List of phpdoc-like projects for generating documentation from javadoc-annotated php files

Since there's a lots of phpdoc-like php documentors and the like projects on the webs, and they are all named similar if not equal, I wanted to write a little overview:

phpdoctor of 02/2011

Currently using this, namespace support plus UML stuff.

phpdoctor of 01/2011

Didn't test it, looks good.

@bxt
bxt / proxy.py
Last active August 30, 2020 15:57
A very basic caching python HTTP proxy server.
# Originally from http://sharebear.co.uk/blog/2009/09/17/very-simple-python-caching-proxy/
#
# Usage:
# A call to http://localhost:80000/example.com/foo.html will cache the file
# at http://example.com/foo.html on disc and not redownload it again.
# To clear the cache simply do a `rm *.cached`. To stop the server simply
# send SIGINT (Ctrl-C). It does not handle any headers or post data.
import BaseHTTPServer
import hashlib
@bxt
bxt / csv-export.sh
Created September 13, 2011 20:58
Exporting whole MySQL databse to CSV files
#!/bin/bash
# USAGE: Will create a .tar.gz with CSVs of all tables in schema.
# Configure below and run as root (i.e. the user mysql runs as)
#
# The script will (or should) SELECT * INTO OUTFILE your tables
# and save them into csv files under /tmp dir first, then name them
# like the tables and move them thogether into a directory. Then
# it will tar everything together and chown you the tarball.
# Schema to export:
+ + + + [ >
+ + + + + +
+ + + + + +
+ + + < - ]
> . - - - -
- - - - - .
@bxt
bxt / cat.bf
Created December 14, 2019 02:13
Cat
🐱 in UTF-16 = 55357 56369
soo...
15*15 = 225
225 + 10 = 235
235*235 = 55225
8, 88, 38, 58, 98, 68, 78, 48, 28, 18, 80, 3, 30, 83, 33, 53, 93, 63, 73, 43, 23, 13, 1, 81, 31, 51, 91, 61, 71, 41, 21, 11, 5, 85, 35, 55, 95, 65, 75, 45, 25, 15, 50, 100, 9, 80, 39, 59, 99, 69, 79, 49, 29, 19, 90, 6, 86, 36, 56, 96, 66, 67, 46, 26, 16, 60, 7, 87, 37, 57, 97, 67, 77, 47, 27, 17, 70, 4, 48, 34, 54, 94, 64, 74, 44, 24, 14, 40, 10, 20, 2, 82, 32, 52, 92, 62, 72, 42, 22, 12
@bxt
bxt / xml-to-csv.rb
Created April 26, 2017 22:53
Convert XML to CSV file using Ruby (nokogiri)
require 'csv'
require 'nokogiri'
filename = "timeentries"
doc = File.open("#{filename}.xml") { |f| Nokogiri::XML(f) }
entries = doc.css('time-entry')
CSV.open("#{filename}.csv", "wb") do |csv|
@bxt
bxt / numcompare.jsx
Created May 14, 2019 16:42
Comparison of Javascript number conversions
const potentialNumbers = [
null,
undefined,
'',
'x',
1,
1.0,
'1',
' 1',
'1 ',
@bxt
bxt / .bashrc
Last active April 4, 2019 16:08
some stuff for .bashrc
# .bashrc commands by bxt
# color promt:
PS1="\@ \[\033[0;35m\]\u@\\h\[\033[0m\]:\w> "
# actually I sometimes use this one (shorter, 24h clock)
PS1=" \t \[\033[0;35m\]:\w>\[\033[0m\] "
# Change shell apps language to english:
export LANG=C
@bxt
bxt / merge_git_repos.md
Last active January 29, 2018 18:26
Git: Merge other repository into subfolder

Copy the child repo to your /tmp (Or into another ramdisk, should be faster)

cd into the new repo.

Now lets rewirte stuff.

Move into subdirectory (here called "report"):

git filter-branch --index-filter \

'git ls-files -s | sed "s-$(printf '''\t''')"*-&report/-" |