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
-- generate random assembly for tiny | |
opcodes = { | |
{{ 'AND', 'm', 'm' }, { 'AND', 'm', 'c' }}, | |
{{ 'OR', 'm', 'm' }, { 'OR', 'm', 'c' }}, | |
{{ 'XOR', 'm', 'm' }, { 'XOR', 'm', 'c' }}, | |
{{ 'NOT', 'm' }}, | |
{{ 'MOV', 'm', 'm' }, { 'MOV', 'm', 'c' }}, | |
{{ 'RANDOM', 'm' }}, | |
{{ 'ADD', 'm', 'm' }, { 'ADD', 'm', 'c' }}, | |
{{ 'SUB', 'm', 'm' }, { 'SUB', 'm', '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
/* Roman numbers calculator | |
* compile with something like: `bison rocalc.y && gcc -o rocalc rocalc.tab.c -lm` | |
* Requires: Bison >= 3.0 | |
* Author: silverweed | |
*/ | |
%{ | |
#include <math.h> | |
#include <stdio.h> | |
#include <string.h> | |
int yylex(void); |
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
rovars: rovars.tab.c lex.yy.c | |
gcc -o rovars $^ -lm | |
rovars.tab.c: rovars.y | |
bison -d $< | |
lex.yy.c: rovars.l | |
flex $< |
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
{-# LANGUAGE OverloadedStrings #-} | |
-- Emit sitemap for maud (requires access to maud db) | |
import Database.MongoDB | |
import System.Environment | |
import Data.Time.Clock.POSIX | |
import qualified Data.Time.Format as DTF | |
import Data.List (intercalate) | |
import Data.List.Split | |
domain :: String |
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/gawk -f | |
# C / C++ code minifier by silverweed | |
# Strips all superfluous blank spaces still producing compilable code. | |
# Somewhat tested. | |
BEGIN { | |
for (i = 1; i < length(ARGV); ++i) { | |
if (match(ARGV[i],/^-([0-9]+)$/,mch)) { | |
maxlines = mch[1] | |
} |
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
# http://www.reddit.com/r/dailyprogrammer/comments/32vlg8/20150417_challenge_210_hard_loopy_robots/ | |
type Point{T <: Real} | |
x :: T | |
y :: T | |
end | |
const NORTH = uint8(0) | |
const EAST = uint8(1) | |
const SOUTH = uint8(2) | |
const WEST = uint8(3) |
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/python3 | |
# simple Pokepon client | |
# by silverweed | |
import telnetlib | |
import getpass | |
import hashlib | |
import sys | |
import signal | |
from threading import Thread | |
import re |
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
-- Example ROCK program | |
-- Print all primes up to limit. | |
-- Note: the function calling convention is that: | |
-- 1- arguments are passed via the $arg, $arg2, ... variables. | |
-- 2- return values are passed via the $res, $res2, ... variables. | |
-- 3- all those variables must be declared by the callee. | |
-- 4- internally, all functions use labels with names prefixed by | |
-- function_name_* | |
-- 5- internally, all functions call variables with a leading _. | |
-- This means that all variables starting with a _ should be considered |
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
/* experimental hash library in ANSI C | |
* @author silverweed | |
* @license GNU GPL v3 | |
*/ | |
#include "hash.h" | |
#include <stdlib.h> | |
#define DEBUG 1 | |
#if DEBUG >= 1 |
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
window.startClock = (finalTime, startingDiffHrs) -> | |
$ = init() | |
drawCircle = (coord) -> | |
sw 2 | |
s circle coord... | |
fcol 0, 0, 0 | |
f circle coord[0], coord[1], coord[2]/20 | |
for i in [1..10] | |
a = 2*PI/10 * i |
OlderNewer