Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ridiculousfish
ridiculousfish / inotify test
Last active August 29, 2015 14:01
inotify test that fails on travis-ci
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <sys/inotify.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#define INOTIFY_TEST_PATH "/tmp/inotify_test.tmp"
import Haste
import Haste.App
import Haste.Foreign
server_func_1 :: Server (String)
server_func_1 = return "func1"
server_func_2 :: Server ()
server_func_2 = return ()
<html>
<head>
</head>
<body>
Hello World
<script type="text/javascript" src="test.js"></script>
<script type="text/javascript">
window.setTimeout(function(){
Haste.hs_entry_point()
}, 1000)
@ridiculousfish
ridiculousfish / index.html
Created November 23, 2014 01:39
haste html 2
<html>
<head>
</head>
<body>
Hello World
<script type="text/javascript" src="test.js"></script>
<script type="text/javascript">
window.setTimeout(function(){
Haste.hs_entry_point("foo", "bar")
}, 1000)
{-# LANGUAGE ForeignFunctionInterface #-}
import Haste
import Haste.App
import Haste.Foreign
anything :: Server ()
anything = return ()
entry_point :: String -> String -> IO ()
entry_point regex_str lang = do
@ridiculousfish
ridiculousfish / test_clang.s
Created November 24, 2014 07:57
clang's inner block
.LBB0_10: # Parent Loop BB0_9 Depth=1
# => This Inner Loop Header: Depth=2
cltq
imulq $-2004318071, %rax, %rbp # imm = 0xFFFFFFFF88888889
shrq $32, %rbp
movl %eax, %ebx
addl %ebp, %ebx
movl %ebx, %ebp
sarl $6, %ebp
movl %ebx, %edi
@ridiculousfish
ridiculousfish / test_gcc.s
Created November 24, 2014 07:58
gcc's inner block
.L13:
movl $-2004318071, %eax
movl $120, %esi
movl %ecx, %r11d
imull %ecx
movl %ecx, %eax
andl $1023, %r11d
sarl $31, %eax
leal (%rcx,%rcx), %r10d
leal (%rcx,%rbx), %r8d
.LBB0_10: # Parent Loop BB0_9 Depth=1
# => This Inner Loop Header: Depth=2
movl %r8d, %ecx
movl $2290649225, %eax # imm = 0x88888889
imulq %rcx, %rax
movq %rax, %rdi
shrq $38, %rdi
imull $120, %edi, %edi
movl %r8d, %r14d
subl %edi, %r14d
.LBB0_10: # Parent Loop BB0_9 Depth=1
# => This Inner Loop Header: Depth=2
leal (%rdi,%rdi), %ecx
movl %edi, %eax
movl $2290649225, %r9d # imm = 0x88888889
imulq %rax, %r9
movq %r9, %r8
shrq $38, %r8
imull $120, %r8d, %edx
movl %edi, %r8d
@ridiculousfish
ridiculousfish / sort vs sort
Last active August 29, 2015 14:11
sort vs sort
// c++ -std=c++11 -O3 sort.cpp ; ./a.out
// qsort: 674 ms
// std::sort: 1104 ms
#include <string.h>
#include <stdio.h>
#include <chrono>
#include <string>
#include <vector>
#include <iostream>