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
Config( | |
event_dispatcher: ( | |
// The key used to switch from normal operation to controller emulation: | |
// Grave (= tilde) is the key to the left of number 1 on the number row, | |
// and should work well for most cases | |
toggle_key: Grave, | |
), | |
event_handler: ( | |
// Unitless coefficient, scale 0 -> +inf as you would expect |
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> | |
int f(int x) { | |
return x * x; | |
} | |
void g(void *p) { | |
printf("5 * 5 = %d\n", (*((int (*)(int)) p))(5)); | |
} |
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 <stdint.h> | |
void print_flags(uint8_t flags) { | |
printf("flags:\n"); | |
printf("sign\t= %d\nzero\t= %d\nacarry\t= %d\n" | |
"parity\t= %d\ncarry\t= %d\n", | |
(flags & 0x80) >> 7, (flags & 0x40) >> 6, | |
(flags & 0x10) >> 4, (flags & 0x04) >> 2, | |
(flags & 0x01) >> 0); |
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
public static Matrix<Matrix<Integer>> multiplyNested(Matrix<Matrix<Integer>> a, Matrix<Matrix<Integer>> b) { | |
return a.multiply(b, (m1, m2) -> { | |
m1.add(m2, Integer::sum); | |
}, (m1, m2) -> { | |
m1.multiply(m2, Integer::sum, (x, y) -> x * y); | |
}); | |
} | |
public static Matrix<PairWithOperators> multiplyList(List<Matrix<PairWithOperators>> matrices) { | |
return matrices.stream() |
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
function QTree (center, radius) { | |
this.center = center | |
this.radius = radius | |
this.children = [[null, null], [null, null]] | |
this.points = [] | |
this.pointlimit = 1 | |
} | |
QTree.prototype.addPoint = function(point) { | |
var pointrel = [point[0] - this.center[0], point[1] - this.center[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
var tc = require('telnet-client'); | |
var telnet = new tc(); | |
var params = { | |
host: 'horizons.jpl.nasa.gov', | |
port: 6775, | |
shellPrompt: /(Horizons> $|: $|:$)/, | |
timeout: 1500, | |
echoLines: true, | |
removeEcho: true |
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
// Node.js Telnet client | |
var events = require('events') | |
var net = require('net') | |
var Promise = require('bluebird') | |
var socket = new net.Socket() | |
var util = require('util') | |
// define a constructor (object) and inherit EventEmitter functions | |
function Telnet() { |
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=[ord(d)*2-81 for d in input() if d in['(',')']];b=[sum(a[:d+1])for d in range(len(a))];1 if abs(max(b))+abs(b[-1]) else 0 |