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
syntax on | |
set autoindent | |
set smartindent | |
set nocp | |
filetype plugin on | |
au BufRead,BufNewFile *.rc set filetype=rc | |
set tabstop=4 | |
set shiftwidth=4 | |
set expandtab | |
set number |
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 ruby | |
# Run with | |
# $ chmod +x chat.rb && ./chat.rb | |
# or | |
# $ ruby chat.rb | |
require 'socket' | |
require 'thread' |
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 ruby | |
HEIGHT = 1024 | |
WIDTH = 1024 | |
f = File.new("sample.pgm", "w") | |
f.puts "P2" | |
f.puts "#{HEIGHT} #{WIDTH}" | |
f.puts 255 | |
f.puts "# Generated by pgen.rb (C) Akos Kovacs" | |
HEIGHT.times do |row| |
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 <aklisp.h> | |
#include <stdio.h> | |
AKL_CFUN_DEFINE(hello, in, args) | |
{ | |
printf("Hello, world from 'hello' module!\n"); | |
/* Every function must return something, | |
the type of 'akl_value' */ | |
return &NIL_VALUE; | |
} |
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 <string.h> | |
#include <stdlib.h> | |
#include <sys/mman.h> | |
typedef int (*func_t)(void); | |
int main(int argc, char *argv[]) | |
{ | |
char *fstart = "\x55\x48\x89\xe5\x48\x31\xc0"; |
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 <string.h> | |
#include <stdlib.h> | |
#include <sys/mman.h> | |
typedef int (*func_t)(void); | |
int main(int argc, char *argv[]) | |
{ | |
/* push %ebp |
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
module Main where | |
import System.Environment (getArgs) | |
import Data.List | |
import Matrix | |
import IO | |
main :: IO () | |
main = do | |
hSetBuffering stdout NoBuffering |
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
module MyList where | |
data MyList a = Cons a (MyList a) | |
| MyNil deriving (Show, Eq) | |
{- | |
A simple linked list module | |
Some examples: | |
mylist = (Cons 10 (Cons 99 (Cons 11 (Cons 1 MyNil)))) | |
myHead myList # => 10 | |
myTail myList # => Cons 99 (Cons 11 (Cons 1 MyNil)) |
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
# A very simple and awesome Lisp interpreter in ruby | |
# Usage: | |
# require './rb_lisp.rb' | |
# RBLisp::Interpreter.new("(print (+ 5 (* 99 5)))") # => will print 500 | |
module RBLisp | |
class Value | |
attr_accessor :type, :value | |
def initialize(args) |
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
make_pi :: Int -> Double | |
make_pi n = product [2.0/(a x)|x <- [0..n]] where | |
a 0 = 1.0 | |
a 1 = sqrt 2 | |
a n = sqrt(2+(a (n-1))) |
OlderNewer