Skip to content

Instantly share code, notes, and snippets.

Chris beakr

Block or report user

Report or block beakr

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
@beakr
beakr / install-gtk.sh
Created Feb 3, 2014
Install GTK+ 3.0 on Mac OS X.
View install-gtk.sh
# Use Python 2.7
$ pyenv global system
# Use Homebrew to install
$ brew install gtk+3
View gist:8949906
/Users/chris/.rvm/gems/ruby-2.0.0-p247/gems/json-1.8.1/lib/json/ext/parser.bundle: [BUG] Segmentation fault
ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-darwin12.4.0]
-- Crash Report log information --------------------------------------------
See Crash Report log file under the one of following:
* ~/Library/Logs/CrashReporter
* /Library/Logs/CrashReporter
* ~/Library/Logs/DiagnosticReports
* /Library/Logs/DiagnosticReports
the more detail of.
@beakr
beakr / repl.c
Last active Aug 29, 2015
Simple Ruby REPL with mruby. Made as a test for the mruby C API.
View repl.c
#include <stdio.h>
#include <mruby.h>
#include <mruby/compile.h>
int main(int argc, char ** argv)
{
mrb_state * mrb = mrb_open();
char code[250];
while (1) {
printf("[max:250]> ");
View sprite.cc
#include <engine/sprite.hh>
#include <string>
#include <SDL/SDL.h>
#include <SDL/SDL_image.h>
namespace mnts
{
Sprite::Sprite(SDL_Surface * gameScreen, std::string texture, int x, int y)
{
@beakr
beakr / readfile.cc
Created Feb 23, 2014
Always keep this Gist close to your heart. You will love it forever.
View readfile.cc
char * readfile(const char * f)
{
ifstream in(f, std::ifstream::binary);
in.seekg(0, in.end);
int size = in.tellg();
in.seekg(0);
char * buf = new char[size];
in.read(buf, size);
View script.py
def init():
# ... Initialize entities ...
def update():
# ... Update entities ...
View fork.c
#include <stdio.h>
int main(void)
{
int pid;
pid = fork();
if(pid > 1) {
printf("I AM THE PARENT PROCESS\n");
} else if(pid == 0) {
printf("I AM THE CHILD PROCESS\n");
@beakr
beakr / task.py
Created Mar 1, 2014
Task running decorator.
View task.py
tasks = []
def task(meth):
tasks.append(meth)
def new(*args): return meth(*args)
return new
def call_task(task_id):
(tasks[id])()
@beakr
beakr / get_output.py
Created Mar 9, 2014
Get command output in Python.
View get_output.py
import subprocess
# rstrip() is used to remove the line terminator at the end of most command output.
host = subprocess.check_output(['command', .. args ..], stderr=subprocess.STDOUT).rstrip()
@beakr
beakr / cpp11_syntastic.vim
Created Mar 9, 2014
Debug C++11 with syntastic.
View cpp11_syntastic.vim
let g:syntastic_cpp_compiler_options = '-std=c++0x'
You can’t perform that action at this time.