Skip to content

Instantly share code, notes, and snippets.

View alk's full-sized avatar

Aliaksiej Kandracienka (aka Aliaksei Kandratsenka) alk

View GitHub Profile
@alk
alk / idea-global-libs.rb
Created January 13, 2010 22:07
Nice way to build IntelliJ IDEA's global libraries list from installed java packages on your Debian/Ubuntu system
#!/usr/bin/env ruby
# this script builds applicationLibraries.xml for IDEA from java
# packages on your debian/ubuntu system
#
# This is public domain
require 'rubygems'
require 'activesupport'
require 'erb'
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
export PATH=$PATH:/var/lib/gems/1.8/bin:/usr/games
# don't put duplicate lines in the history. See bash(1) for more options
#!/bin/env ruby
# ALK: this was ripped from http://github.com/fauna/memcached/blob/master/test/profile/benchmark.rb
# HERE = File.dirname(__FILE__)
# $LOAD_PATH << "#{HERE}/../../lib/"
# UNIX_SOCKET_NAME = File.join(ENV['TMPDIR']||'/tmp','memcached')
require 'rubygems'
require 'memcached'
#!/usr/bin/ruby
require 'tempfile'
require 'optparse'
require 'pp'
module Kernel
def poll_for_condition(timeout = 10, fail_unless_ok = true)
start = Time.now.to_f
lxc-run: fast-rebuild
./cloning-networking.rb make do-lxc-run-tail
lxc-cluster: fast-rebuild
gnome-terminal --profile=remote --active $(foreach i,1 2 3, $(if $(subst 1,,$(i)), --tab) -e "./cloning-networking.rb make do-lxc-run-tail")
do-lxc-run-tail:
rm -rf /var/tmp/$(LXC_IP)
cp -rl . /var/tmp/$(LXC_IP)
$(MAKE) -C /var/tmp/$(LXC_IP) conf-clean
#!/usr/bin/ruby
require 'set'
infos = IO.read('/var/lib/dpkg/available').split("\n\n")
to_delete = IO.popen("dpkg -l '*'") {|f| f.readlines.grep(/^un/).map {|l| l.split(/\s+/)[1]}}
to_delete = to_delete.map {|n| "Package: #{n}"}.to_set
new_infos = infos.reject do |entry|
first_line = entry.split("\n", 2)[0]
to_delete.include? first_line
We couldn’t find that file to show.
#!/usr/bin/ruby
require 'rubygems'
gem 'escape'
require 'escape'
require 'test/unit'
Dir.chdir(File.dirname(__FILE__) + "/moxi")
system 'make -j2' || exit(1)
#include <stdint.h>
struct KindaAtomic64 {
union data_type {
volatile uint64_t u64;
#ifndef WORDS_BIGENDIAN
struct {
volatile uint32_t low;
volatile uint32_t high;
} u32;
var AmbTest = TestCase("AmbTest");
AmbTest.prototype.testBasic = function () {
function beats(ix, iy, jx, jy) {
return ix == jx || Math.abs(ix-jx) == jy-iy;
}
var result = ambRun(function (amb, fail) {
var queenPos = [];
for (var i = 0; i < 8; i++) {
var lastPos = amb([0,1,2,3,4,5,6,7]);