Skip to content

Instantly share code, notes, and snippets.

View joehakimrahme's full-sized avatar

Joe H. Rahme joehakimrahme

  • Red Hat
  • Milano
View GitHub Profile
import voluptuous
import yaml
schema = voluptuous.Schema({
voluptuous.Required("name"): str,
"sex": voluptuous.Any("Male", "Female", "N/A"),
"class": str,
"title": str,
"hp": [int],
ConVarRef dota_workshoptools_limited_ui doesn't point to an existing ConVar
Did not detect any valid joysticks.
Using AudioQueue Interface
Wave sound initialized
Trying cache : '/Users/joehakimrahme/Library/Application Support/Steam/SteamApps/common/dota 2 beta/dota/sound/sound.cache'
m_mapGameModeDetails contains 0 items
Loaded default backpack filters.
Restarting sound playback
[SteamDatagramClient] Got network config from CDN. Loaded revision 9 OK
In logon queue; waiting for GC to confirm connection.
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
int main(int argc, char** argv){
fork();
/* The function getpid() returns the PID of the current process */
fprintf(stdout, "I'm a process, my PID is: %d", getpid());
return EXIT_SUCCESS;
@joehakimrahme
joehakimrahme / example1.c
Created February 2, 2011 22:36
First use of the fork() function
#include <stdio.h>
#include <stdlib.h>
int main (int argc, char** argv){
fork();
fprintf(stdout, "Hello World");
return EXIT_SUCCESS;
}
function eat(food)
print ("I eat " .. food)
end
function drink(food)
print ("I drink " .. food)
end
function swallow (food)
func = {[true] = eat,
@joehakimrahme
joehakimrahme / gist:2702849
Created May 15, 2012 15:55
Lua multiline comments
--[[
print("hello world")
--]]
-- By adding a single hypen at the beginning of the top line, you effectively uncomment the whole block:
---[[
print("hello world")
--]]
@joehakimrahme
joehakimrahme / table-ex1.lua
Created May 15, 2012 22:02
Lua presentation
t1 = { a=1, b="hello" }
print (t1["a"]) -- outputs "1"
t2 = { [1<4] = "foo", [1<10] = "bar" }
print (t2[true]) -- outputs "bar"
@joehakimrahme
joehakimrahme / table-ex2.lua
Created May 15, 2012 22:11
Programming in Lua
t3 = {1, 4, 5, 2, 31}
print (t3[3]) -- will output "5"
t4 = {a = "foo", b = 3}
print (t4.a) -- will output "foo"
print (t4.b) -- will output "3"
@joehakimrahme
joehakimrahme / tableswitch.lua
Created May 16, 2012 08:28
Switch table in Lua
abs = function(x)
test = {
[true]=-x,
[x>0]=x,
[x==0]=0}
return test[true]
end
print (abs(-3)) -- outputs "3"
@joehakimrahme
joehakimrahme / K&R: 1.21
Created June 4, 2012 09:13
Entab: Replace blanks by tabs
#include <stdio.h>
#define TABSTP 4
/* TODO: read this string from argv,
to test different scenarios */
char* input_str = "Something to test it";
int nexttbstp (int position);
int printblank(int start, int end);