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
#!/bin/sh | |
# Download binutils, gcc, the linux kernel, glibc | |
# define the prefix | |
export PREFIX=/opt/armhf | |
# change PATH to include the target directory | |
export PATH=$PREFIX/bin:$PATH |
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
/* | |
* drivertest.cpp | |
* Vector addition (host code) | |
* | |
* Andrei de A. Formiga, 2012-06-04 | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> |
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
#lang racket | |
;; Write a simple C64 assembly program to a PRG file, along with a line | |
;; of BASIC program to load the machine-language code. | |
;; The assembly program that will be run | |
(define program | |
(bytes #xA9 #x00 ; LDA #00 | |
#x8D #x20 #xD0 ; STA $D020 | |
#x8D #x21 #xD0 ; STA $D021 |
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
// Discriminated Union in TypeScript | |
interface Integer { | |
tag: 'integer'; | |
value: number; | |
} | |
interface Sum { | |
tag: 'sum'; | |
op1: Expression; |
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 std::iter::Peekable; | |
use std::str::Chars; | |
fn main() { | |
let s = "Aussonderungsaxiom".to_string(); | |
let mut bf = Buffer::new(&s); | |
println!("First character should be A: {}", bf.peek().expect("q")); | |
println!("First char: {}", bf.next().expect("q")); | |
println!("Next char: {}", bf.next().expect("q")); |
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
// Fetch an activity from the Bored API | |
type promise<+'a> = Js.Promise.t<'a> | |
@send external then: (promise<'a>, @uncurry ('a => promise<'b>)) => promise<'b> = "then" | |
@send external thenResolve: (promise<'a>, @uncurry ('a => 'b)) => promise<'b> = "then" | |
module Response = { | |
type t<'data> | |
@send external json: t<'data> => promise<'data> = "json" |
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 ported from | |
// "Web Development with Node and Express", 2nd edition | |
// by Ethan Brown | |
// bindings to the node API | |
type res | |
type req | |
type server | |
@module("http") external createServer : ( @uncurry (req, res) => unit ) => server = "createServer" |
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 call/cc to write a program that loops indefinitely, | |
;; printing a sequence of numbers beginning at zero. | |
;; Do not use any recursive procedures, and do not use any assignments. | |
(let ((kontp (call-with-current-continuation (lambda (k) (cons k 0))))) | |
(let ((i (cdr kontp)) | |
(kont (car kontp))) | |
(display i) | |
(display " ") | |
(kont (cons kont (+ 1 i))))) |
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
// removes acute accents represented in separate characters | |
// e.g. a + ' = á | |
function removeAcute(s) { | |
let res = "" | |
let i = 0 | |
for (i = 0; i < s.length; ++i) { | |
if (s.codePointAt(i) != 769) | |
res = res + s.charAt(i) | |
} | |
return res |
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
let py = document.querySelector('#playerFrame'). | |
contentDocument.querySelectorAll('rt') | |
let escondePinYin = () => py.forEach( e => e.style.color = '#FFFFFF' ) | |
let mostraPinYin = () => py.forEach( e => e.style.color = '#000000' ) |
NewerOlder