Skip to content

Instantly share code, notes, and snippets.

Markus Fisch markusfisch

Block or report user

Report or block markusfisch

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@markusfisch
markusfisch / README.md
Last active Aug 29, 2015
Format data and automatically allocate memory to be of sufficient length
View README.md

maprintf

Format data and automatically allocate memory to be of sufficient length.

This is a care-free alternative to snprintf() with strings of arbitrary length.

Sample

@markusfisch
markusfisch / .vimrc
Created May 8, 2014
Put this in your .vimrc to easily switch between tabs (F5) and spaces (F6) and highlight improper indent
View .vimrc
" Use Tabs
function! UseTabs()
" Highlight tabs within lines, trailing whitespace and
" spaces at the beginning of lines
match errorMsg /[^\t]\zs\t\+\|\s\+$\|^[\t]*[ ]\+[\t]*[^\*]/
set noexpandtab
endfunc
nnoremap <F5> :call UseTabs()<CR>
" Use Spaces
@markusfisch
markusfisch / workspace.sh
Created May 16, 2014
bash script to easily switch to next workspace in Ubuntu compbiz using wmctrl
View workspace.sh
#!/usr/bin/env bash
# Switch to next viewport
next_viewport()
{
if (( X+VIEWPORT_WIDTH >= TOTAL_WIDTH ))
then
X=0
if (( Y+VIEWPORT_HEIGHT >= TOTAL_HEIGHT ))
@markusfisch
markusfisch / README.md
Last active Aug 29, 2015
Quick and dirty SQL Web Console for PHP
View README.md

SQL Web Console

A quick and dirty SQL web console for PHP5+.

Please don't use this in production!

Use this as a quick drop-in to access your web site's database when you can't use SSH (e.g. when you're in a corporate network that blocks SSH. Yes, I know, that's totally braindead and every IT staff doing so should

@markusfisch
markusfisch / README.md
Last active Aug 29, 2015
Encode UTF-8 strings to be used with XML
View README.md

entity

Encode UTF-8 strings to be used with XML.

Converts "Tästø÷…" into "T&#xE4;st&#xF8;&#xF7;&#x2026;".

Quick sample:

#include "entity.h"
@markusfisch
markusfisch / README.md
Created Jul 28, 2014
Format strings into a expanding buffer
View README.md

sbprintf

Format strings into a expanding buffer.

Sample

struct sbprintf_string_buffer sb = { NULL, NULL, 0 };
@markusfisch
markusfisch / android.vim
Created Apr 24, 2015
VIM colorscheme, green and blue on a dark background
View android.vim
set background=dark
highlight clear
if exists( "syntax on" )
syntax reset
endif
let g:colors_name = "android"
hi Normal ctermfg=251 ctermbg=235
View how-to-contribute.md

How To Contribute

  • Comply to the existing [code style][style].
  • Be [consistent][pikestyle].
  • Be [pragmatic][perils].
  • Choose [clear and simple semantics][semantics].
  • Prefer many short methods over of a lot of [indent][kernel].
  • Comment only [what the code cannot say][comment].
  • Test.
@markusfisch
markusfisch / mkpw.rb
Last active Sep 25, 2015
mkpasswd in ruby
View mkpw.rb
#!/usr/bin/env ruby
c = "abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789!-_".split( // )
(ARGV.length.zero? ? [8] : ARGV).each do |n|
puts (0...n.to_i).map{ c[rand( c.size )] }.join
end
@markusfisch
markusfisch / gist:3136580
Created Jul 18, 2012
Pan and zoom/pinch images with MOAI
View gist:3136580
------------------------------------------------------------------------------
-- local members
------------------------------------------------------------------------------
local devWidth, devHeight = 0, 0
local viewport = nil
local layer = nil
local quad = nil
local prop = nil
local imgWidth, imgHeight = 0, 0
You can’t perform that action at this time.