Skip to content

Instantly share code, notes, and snippets.

View zeroeth's full-sized avatar
🤖
🐱 🤖 🐱 🤖

[0] zeroeth

🤖
🐱 🤖 🐱 🤖
View GitHub Profile
@markusfisch
markusfisch / README.md
Last active August 15, 2026 18:36
bash script to build a texture atlas with a little help from ImageMagick

mkatlas

[BASH][1] script to build a [texture atlas][2] for small/medium web sites/games. Requires [ImageMagick][3].

Usage

Basic

@dkleehammer
dkleehammer / app.js
Created July 31, 2013 22:08
Backbone/Marionette JS session handling example
define([
'marionette',
'router',
'controller',
'modules/auth',
'modules/vent',
'views/_layout'
], function(Marionette, Router, Controller, Auth, Vent, Layout){
var App = new Marionette.Application();

Displaying images in the terminal with tput and echo

output

Requires ImageMagick, easily available from your favorite package manager. Tested on Linux and OSX
convert image.png -resize 40 txt:-|sed -E 's/://;s/\( ? ?//;s/, ? ?/,/g;s/\)//;s/([0-9]+,[0-9]+,[0-9]+),[0-9]+/\1/g;s/255/254/g;/mage/d'|awk '{print $1,$2}'|sed -E 's/^0,[0-9]+ /print "echo;tput setaf "\;/;s/^[0-9]+,[0-9]+ /print "tput setaf ";/;s/(.+),(.+),(.+)/\1\/42.5*36+\2\/42.5*6+\3\/42.5+16/'|bc|sed 's/$/;echo -n "  ";/'|tr '\n' ' '|sed 's/^/tput rev;/;s/; /;/g;s/$/tput sgr0;echo/'|bash
@darvid
darvid / generate_item_icons.py
Last active May 23, 2018 20:55
Generates an indexed table of item entries and icons from WoW DBCs (converted to CSV).
"""
Generates SQL to populate a table of item IDs mapped to icon names.
* Step 1. Convert `Item.dbc` and `ItemDisplayInfo.dbc` to CSV files, e.g. with
`http://www.mediafire.com/?1sydm4aoi9i`
* Step 2. Export item quality to CSV with this command:
`mysql -utrinity -p world --execute "SELECT entry, quality `
`INTO OUTFILE '/tmp/item_quality.sql' FIELDS TERMINATED BY ','`
`OPTIONALLY ENCLOSED BY '\"' LINES TERMINATED BY '\n'`
`FROM item_template"`
@jsteiner
jsteiner / projections.json
Last active June 14, 2016 17:38
Example Rails.vim projections for a Backbone.js project.
{
"app/assets/javascripts/models/*.coffee": {
"command": "jmodel",
"alternate": "spec/javascripts/models/%s_spec.coffee",
"template": "class @AppName.Models.%S extends Backbone.Model"
},
"app/assets/javascripts/collections/*.coffee": {
"command": "jcollection",
@allisonsalmon
allisonsalmon / Autobuilder.cs
Created May 9, 2013 18:05
Some basics on setting up an auto builder for Unity 3D
using UnityEditor;
using System.Collections;
public class Autobuilder {
static void PerformBuild()
{
string [] scenes = { @"Assets/Scenes/Main Game.unity",
@"Assets/Scenes/Main Menu.unity",
@robcowie
robcowie / .mpdconf
Last active December 14, 2024 14:10
Install mpd on OSX 10.8
## ~/.mdpconf
port "6600"
music_directory "~/Music/"
playlist_directory "~/.mpd/playlists"
db_file "~/.mpd/mpd.db"
log_file "~/.mpd/mpd.log"
pid_file "~/.mpd/mpd.pid"
state_file "~/.mpd/state"
#bind_to_address "~/.mpd/mpd.sock"
@joshed-io
joshed-io / com.darkice.plist
Created November 21, 2012 18:11
launchd plists for Icecast, Darkice, Jack Audio, and Github's Play
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.darkice</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<false/>
@zeroeth
zeroeth / dna.c
Created October 23, 2012 00:13
obfuscated c code competition
// taken from http://www.ioccc.org/years.html
#include <ncurses.h>
#define T typedef unsigned
T long G;
T short CT;
#define ATG srand(time(0)); initscr(); cbreak(); noecho(); start_color();
#define GG(T,C) attrset(A_BOLD*!(T)|COLOR_PAIR(C%2+1));
#define AC(G) init_pair(G/2,G,nodelay(stdscr,G/3));
#define TCT(A,G,C) mvaddch(A+CTT*6+4,CGA*12+G,C)

Introduction

  • C-a == Ctrl-a
  • M-a == Alt-a

General

:q        close
:w        write/saves
:wa[!]    write/save all windows [force]
:wq       write/save and close