Skip to content

Instantly share code, notes, and snippets.

View odiroot's full-sized avatar
💭
It's complicated

Michal Odnous odiroot

💭
It's complicated
View GitHub Profile
@odiroot
odiroot / antlr3
Created May 3, 2011 13:57
Skrypty do odpalania ANTLR - zakładają że JARy są w /usr/share/java
#!/bin/sh
export CLASSPATH=/usr/share/java/stringtemplate.jar:/usr/share/java/antlr-3.1.3.jar
exec java org.antlr.Tool "$@"
@odiroot
odiroot / crossover.py
Created November 5, 2011 23:19
Custom GA operators
def custom_crossover(genome, **kwargs):
mom = kwargs["mom"]
dad = kwargs["dad"]
mins = mom.getParam("min_constr")
maxes = mom.getParam("max_constr")
count = kwargs["count"]
sister = None
brother = None
if count >= 1:
@odiroot
odiroot / gist:1737882
Created February 4, 2012 13:28
Sublime Package Control installation
import urllib2,os; pf='Package Control.sublime-package'; ipp=sublime.installed_packages_path(); os.makedirs(ipp) if not os.path.exists(ipp) else None; urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler())); open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read()); print 'Please restart Sublime Text to finish installation'
@odiroot
odiroot / gist:2020647
Created March 12, 2012 08:06
;) extract links (and topics) to talk pages
var talks = document.querySelectorAll(".row-fluid.section div:nth-child(2) a")
console.log(talks.length)
var titles = [];
var urls = [];
for(i=0; i<talks.length; i++) {
titles.push(talks[i].text);
urls.push(talks[i].href);
}
@odiroot
odiroot / app.js
Created November 7, 2012 09:37 — forked from saniko/app.js file
a very simple bootstrap boilerplate for building backbone.marionette based on require.js
define([
'jquery',
'underscore',
'backbone',
'marionette',
'handlebars',
'text!templates/app_view.html',
'modules/mainMenuView/mainMenuView',
@odiroot
odiroot / bags-layout.js
Created November 18, 2012 11:59
Backbone.js post
var MyLayout = Backbone.View.extend({
subViews: [Foo, Bar], // This can be modified in runtime.
render: function() {
_.each(this.subViews, function(V) {
var widget = new V().render();
this.$el.append(widget.$el);
}, this);
return this;

Keybase proof

I hereby claim:

  • I am odiroot on github.
  • I am odiroot (https://keybase.io/odiroot) on keybase.
  • I have a public key whose fingerprint is FC0E C89A 182E 0F50 B1A9 FFC0 C277 1375 76F9 A770

To claim this, I am signing this object:

@odiroot
odiroot / xcb_cairo_hello_world.v
Created February 4, 2024 17:13
Example of using Cairo over XCB in V to show a minimal GUI
#pkgconfig --cflags --libs xcb
#pkgconfig --libs cairo
#include <xcb/xcb.h>
#include <cairo/cairo-xcb.h>
#include <cairo/cairo.h>
type C.xcb_window_t = u32
type C.xcb_visualid_t = u32
type C.xcb_gcontext_t = u32
type C.xcb_drawable_t = u32