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
/* gcc -Wall -O3 c_sqlite_test.c -lsqlite3 -o c_sqlite */ | |
#include <stdio.h> | |
#include <stdint.h> | |
#include <stdlib.h> | |
#include <stdbool.h> | |
#include <string.h> | |
#include <sqlite3.h> | |
/* Macros to simplify things. */ | |
#define BEGIN_TRANSACTION() do { int e; char em[1024]; \ |
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 "memcat.h" | |
#define MIN(a,b) ((a) < (b) ? (a) : (b)) | |
size_t memcat(uint8_t * dst, | |
struct memdesc * descriptors, | |
size_t descriptor_count, | |
size_t max_len) | |
{ | |
size_t remaining = max_len; |
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
require 'thread' | |
$id = 0 | |
$sem = Mutex.new | |
def next_id | |
n = nil | |
$sem.synchronize do | |
n = $id | |
$id += 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
module Main where | |
import Control.Concurrent | |
import System.IO | |
main :: IO () | |
main = do | |
hSetBuffering stdout NoBuffering | |
mapM_ (forkIO . putStrLn . repeat) ['a'..'z'] | |
threadDelay 1000000 |
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 Units where | |
The goal of this module is to demonstrate some basic unit conversion and | |
manipulation using the Haskell type system. | |
First, let's define our data types. We'll represent things as Doubles for | |
convenience. | |
> newtype Meters = Meters Double deriving (Show) | |
> newtype Feet = Feet Double deriving (Show) |
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
ldr r0, =__stack_start__ | |
ldr r1, =__stack_end__ | |
mov r2, 0x58585858 /* 'XXXX' */ | |
load_stack_word: | |
cmp r0, r1 | |
beq stack_initted | |
str r2, [r0] | |
add r0, r0, #4 | |
b load_stack_word | |
stack_initted: |
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 QuasiQuotes #-} | |
module Data.Cauterize.Generators.C where | |
import Text.PrettyPrint.Mainland | |
import Language.C.Quote.C | |
genC :: IO () | |
genC = print $ ppr f | |
where | |
ty = [cty|int|] |
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 | |
count = ARGV[0] ? ARGV[0].to_i : 1 | |
opens = "(" * count | |
txt = STDIN.read.chomp | |
closes = ")" * count | |
puts(opens + txt + closes) |
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
fn r̄ͬ̇ͦ̓u͗͗̅̐s̔̈́ͯ̄̓ͭ͋tͣͯͦ̂̃̆̓_̍͌̉̃l̆a͐̾̿̋̈́n̉ͬͥ́ͪ̊gͭ͛̾_́cͪͬ͑͂̈oͭͨ̊̋̓ͧm̌̿̐̿ͤ̆͐e̔̓̆ͭͨ̾̚s() { | |
println("ĭ̒̚tͧ̂͆ͫ̄ ̃ͬ͗̍̂c̈͒̊õ͑̓ͩͦ͒m̊͗̐̒esͩ͛!ͨ̀ͩ̀͆̄̚ ĭ̿̈̍̀ͮ͑tͦ͂̉̒̔̇ ̓co͛́̾ͤ̄̉͌m͂͆̀ͫe͛ͨ͌̇͆ͣͥs͂!̇̌̎̆"); | |
} | |
fn main() { | |
r̄ͬ̇ͦ̓u͗͗̅̐s̔̈́ͯ̄̓ͭ͋tͣͯͦ̂̃̆̓_̍͌̉̃l̆a͐̾̿̋̈́n̉ͬͥ́ͪ̊gͭ͛̾_́cͪͬ͑͂̈oͭͨ̊̋̓ͧm̌̿̐̿ͤ̆͐e̔̓̆ͭͨ̾̚s(); | |
} |
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
# First, make the thing that I want. | |
class Object | |
# Becomes passes self to a block. The result of the | |
# operation is the result of the block rather than the | |
# original object. This allows us to transform an object | |
# in-line with a method chain without having to mix-in or | |
# add the method to any of the objects. | |
def becomes | |
yield self |