Skip to content

Instantly share code, notes, and snippets.

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
#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);
}
@acdimalev
acdimalev / gem-depcheck
Created August 4, 2011 10:51
Check for uninstalled gem dependencies.
#!/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
#include "buffer.h"
/* statically allocate tests */
#define TEST_MAX (2 << 8)
struct test {
struct test *next;
char *desc;
int pass;
} tests[TEST_MAX];
<?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);
}