This file contains hidden or 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
<?php | |
$link = mysql_connect('localhost', 'root'); | |
function mysql_results($result) { | |
$foos = array(); | |
while ($row = mysql_fetch_row($result)) { | |
$foo = $row[0]; | |
array_push($foos, $foo); | |
} |
This file contains hidden or 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 "buffer.h" | |
/* statically allocate tests */ | |
#define TEST_MAX (2 << 8) | |
struct test { | |
struct test *next; | |
char *desc; | |
int pass; | |
} tests[TEST_MAX]; |
This file contains hidden or 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/ruby | |
require 'rubygems' | |
installed_gems = Gem::Dependency.new '', Gem::Requirement.default | |
missing = [] | |
# mind the short-hand, looping over installed gem specs | |
specs = Gem.source_index.search installed_gems | |
specs.each do |spec| | |
gem = Gem::Dependency.new spec.name, spec.version | |
# looping over gem dependencies | |
specs = Gem.source_index.search gem |
This file contains hidden or 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 <sys/ioctl.h> | |
#include <unistd.h> | |
#include "unicode_ascii_translation_table.c" | |
#define CSI "\x1B[" | |
int is_ascii_printable(char c) { | |
return (c > 0x1F) & (c != 0x7F); | |
} |
This file contains hidden or 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
from math import * | |
# settings | |
n = 4 | |
radii = [1/2.0 * sqrt((2.0 ** i - 1) / (2.0 ** n - 1)) for i in range(1, n + 1)] | |
# calculate bezier |
This file contains hidden or 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
This just got linked to by the Y combinator news account, without proper context, | |
so a brief introduction: A month ago (end of May / early June 2014) I had a | |
Twitter conversation with a bunch of acquaintances. One tweet in the middle | |
of that thread, with obligatory hyperbole, was me saying that I think VR is | |
bad news. | |
Well, that part of the thread (but not the rest that provides context) recently | |
got retweeted, and then someone asked me if I could explain what I mean by that, | |
and because Twitter is a great platform for delivering 140 character slogans and | |
not so great for lengthy explanations, I wrote this. So, obligatory disclaimer: |
This file contains hidden or 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
21:27:39.987070 IP 127.0.0.1.1234 > 224.0.0.1.1234: UDP, length 60 | |
0x0000: 4500 0058 4699 4000 0111 d3f9 7f00 0001 | |
0x0010: e000 0001 04d2 04d2 0044 5f58 ffff ffff | |
0x0020: ffff 5254 0012 3457 0806 0001 0800 0604 | |
0x0030: 0001 5254 0012 3457 0a00 0802 0000 0000 | |
0x0040: 0000 0a00 0803 0000 0000 0000 0000 0000 | |
0x0050: 0000 0000 0000 0000 |
This file contains hidden or 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
// Retro Arch has a bunch of options and fiddly bits | |
// this is a starting point with just enough wired up to hack on some demos | |
// build with `gcc -shared -fPIC -o retroarch-scratch.so retroarch-scratch.c` | |
// run with `retroarch -L retroarch-scratch.so` | |
// docs are good | |
// https://github.com/libretro/libretro.github.com/blob/master/documents/libretro.pdf | |
// https://github.com/libretro/RetroArch/blob/master/libretro-common/include/libretro.h |
This file contains hidden or 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/python3 | |
# Per's code | |
def sw_binary_divide2(n, d, num_bits): | |
q = 0 | |
r = n | |
d2 = d << (num_bits - 1) | |
for i in range(num_bits): | |
q <<= 1 | |
if r >= d2: |
This file contains hidden or 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
[jamin@dependent 2018-06-06-bindump]$ perf stat -e task-clock,cycles,instructions,cache-references,cache-misses | |
./say hello > /dev/null | |
Performance counter stats for './say hello': | |
0.197061 task-clock:u (msec) # 0.363 CPUs utilized | |
133682 cycles:u # 0.678 GHz | |
115712 instructions:u # 0.87 insn per cycle | |
1486 cache-references:u # 7.541 M/sec | |
937 cache-misses:u # 63.055 % of all cache refs |
OlderNewer