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
// clang -std=c11 -mavx avxvec.c -o avxvec | |
#include <x86intrin.h> | |
#include <stdio.h> | |
// see https://software.intel.com/sites/landingpage/IntrinsicsGuide/#techs=AVX | |
int main() { | |
double mem[4] = {1.0, 2.0, 3.0, 4.0}; | |
//__m256d v = _mm256_load_pd(mem); | |
__m256d v = _mm256_set_pd(1, 2, 3, 4); // (e3, e2, e1, e1) | |
__m256d sq = _mm256_mul_pd(v, v); |
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
import {PF} from "./pf.js"; | |
import {GF} from "./gf.js"; | |
import {GF2n} from "./gf2n.js"; | |
import {BCHCode} from "./bchcode.js"; | |
import {Polynomial, PolynomialUtils} from "./polynomial.js"; | |
{ | |
console.log("[BCHCode with GF]"); | |
const gf = GF(PF(2), 4, [1, 1, 0, 0, 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
# How to build and to run | |
# mkdir build ; cd build/ ; cmake .. ; make ; ./test | |
# (cleanup: rm -r build/) | |
set(CMAKE_C_STANDARD 11) | |
list(APPEND CMAKE_C_FLAGS "-Wall -Wextra -pedantic") | |
add_library(mymalloc SHARED mymalloc.c) | |
add_executable(test test.c) | |
link_directories(.) | |
target_link_libraries(test mymalloc) |
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
#version 300 es | |
precision highp float; | |
//invariant gl_FragCoord; | |
uniform Screen { | |
vec2 wh; | |
} screen; | |
uniform Timer { | |
int count; |
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 of curses: less command | |
import locale | |
import sys | |
import curses | |
def load(): | |
filename = sys.argv[1] | |
with open(filename) as f: | |
return f.readlines(), filename | |
return [], "" |
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
<!doctype html> | |
<html> | |
<head> | |
<script type="module"> | |
// WICG Shape Detection API | |
// - https://wicg.github.io/shape-detection-api/ | |
try { | |
const start = document.getElementById("start"); | |
const video = document.getElementById("video"); | |
const result = document.getElementById("result"); |
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
// Untyped Lambda Calculus on swift-2 | |
enum Expr { | |
case Num(Int) | |
case Ref(String) | |
indirect case Lam(String, Expr) | |
indirect case App(Expr, Expr) | |
func eval(env: Env) -> Val { | |
switch self { | |
case let .Num(v): return Val.Number(v) |
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
"use strict"; | |
// [run the app] | |
// $ npm install electron | |
// $ ./node_modules/.bin/electron . | |
const {app, nativeImage, Tray, Menu, BrowserWindow} = require("electron"); | |
let top = {}; // prevent gc to keep windows |
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
#[homebrew setting for installing to each user directory] | |
#[ENV: put them into "$HOME/.bash_profile"] | |
HOMEBREW=$HOME/.brew | |
export PATH=$HOMEBREW/bin:$PATH | |
export LD_LIBRARY_PATH=$HOMEBREW/lib:/usr/lib | |
export DYLD_FALLBACK_LIBRARY_PATH=$HOMEBREW/lib | |
export C_INCLUDE_PATH=$HOMEBREW/include | |
export CPLUS_INCLUDE_PATH=$HOMEBREW/include |
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
// clang -framework Cocoa app.m -o app | |
// ./app | |
#import <Cocoa/Cocoa.h> | |
int main() | |
{ | |
[NSAutoreleasePool new]; | |
id app = [NSApplication sharedApplication]; | |
[app setActivationPolicy:NSApplicationActivationPolicyRegular]; | |
NewerOlder