View l.bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
function print_usage { | |
echo "Usage: $0 [start|stop|restart]" | |
} | |
if test "$#" -ne 1; then | |
print_usage | |
fi |
View lol.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from __future__ import print_function | |
import curses | |
import functools | |
import sys | |
class Settings(object): |
View map.oz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare | |
fun {Map F L} | |
case L of nil then nil | |
[] H|T then {F H} | {Map F T} | |
end | |
end | |
{Browse {Map fun {$ X} X*X end [1 2 3 4]}} |
View flatten.oz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% if head is nil then answer | |
% if head is integer then append it to answer and flatten tail | |
% if head is list then flatten head and then flatten tail | |
declare | |
fun {FlattenList L} | |
local FlatLoop in | |
fun {FlatLoop L1 Acc} | |
case L1 | |
of nil then Acc |
View transf.oz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local FillRecord in | |
fun {FillRecord Features Values Rec} | |
case Features | |
of H|T then | |
case Values.1 | |
of Lab|Feat|Val then | |
{FillRecord T Values.2 | |
{AdjoinAt Rec H | |
{Transform Lab|Feat|Val}}} | |
[] Val then |
View map.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int pow2(int val) | |
{ | |
return val * val; | |
} | |
int* map(int (*func)(int), int *arr, int len) | |
{ int *res = malloc(sizeof(int) * len); |
View reduce.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> def myreduce(func, list, initial): | |
... def inner(inner_list, acc): | |
... if not inner_list: return acc | |
... else: return inner(inner_list[1:], func(acc, inner_list[0])) | |
... return inner(initial + list, 0) | |
... |
View bsondumpdir.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
import os | |
import sys | |
usage = "USAGE: {0} path".format(sys.argv[0]) | |
if len(sys.argv) != 2: | |
print usage | |
sys.exit(1) |
View str.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
typedef struct Point { | |
int x; | |
int y; | |
} Point; | |
Point *create_point(int x, int y, Point *point) | |
{ | |
//point = struct Point; |
View hello.spec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Name: hello | |
Version: 2.8 | |
Release: 1%{?dist} | |
Summary: The "Hello World" program from GNU | |
License: GPLv3+ | |
URL: http://ftp.gnu.org/gnu/hello | |
Source0: http://ftp.gnu.org/gnu/hello/hello-2.8.tar.gz | |
BuildRequires: gettext |