Skip to content

Instantly share code, notes, and snippets.

View mattkanwisher's full-sized avatar

Matthew Campbell mattkanwisher

View GitHub Profile
@mattkanwisher
mattkanwisher / gist:1108541
Created July 27, 2011 02:29
homebrew error on octave 3.4 (doctor output)
Last login: Tue Jul 26 22:25:22 on ttys009
new-host-3:image_gen kanwisher$ tail -f matt.txt
checking for broken C++ reinterpret_cast... no
checking for gcc... (cached) /usr/bin/cc
checking whether we are using the GNU C compiler... (cached) yes
checking whether /usr/bin/cc accepts -g... (cached) yes
checking for /usr/bin/cc option to accept ISO C89... (cached) none needed
checking dependency style of /usr/bin/cc... (cached) none
checking how to run the C preprocessor... /usr/bin/cc -E
checking whether /usr/bin/cc needs -traditional... no
@mattkanwisher
mattkanwisher / gist:1108549
Created July 27, 2011 02:45
octave 3.4 install error config.log
==> Downloading ftp://ftp.gnu.org/gnu/octave/octave-3.4.0.tar.bz2
File already downloaded in /Users/kanwisher/Library/Caches/Homebrew
==> Using Homebrew-provided fortran compiler.
This may be changed by setting the FC environment variable.
==> ./configure --disable-dependency-tracking --prefix=/usr/local/Cellar/octave/3.4.0 --with-blas=-ldotwrp -framework Accelerate
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... build-aux/install-sh -c -d
checking for gawk... no
#!/usr/bin/env ruby
require 'socket'
require 'optparse'
# Collect INFO from Redis, report it to Graphite
opts = OptionParser.new do |opts|
opts.banner = "Usage: redis-graphite.rb redis-host[:redis-port] graphite-host"
opts.on( '-h', '--help', 'Display this screen' ) do
puts opts
- source_labels:
- instance
modulus: 3
target_label: __hash
action: hashmod
- source_labels:
- __hash
target_label: exporter
regex: "^2$"
action: keep
@mattkanwisher
mattkanwisher / extract_thai_subtitles_to_csv.rb
Last active September 9, 2017 14:17
Extract word frequency list from subtitle file from viki.com and output csv
#this program takes Web Subtitle files from sites like Viki.com and then gets the
#occurrence frequency and outputs a csv, to later be made into an Anki deck
require "webvtt"
require "ffi-icu"
$words = []
def add_word(x)
if x != "." && x != "," && x != " " && x != "-" && x != "!"
pragma solidity ^0.4.2;
contract Migrations {
address public owner;
uint public last_completed_migration;
modifier restricted() {
if (msg.sender == owner) _;
}
pragma solidity ^0.4.13;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
pragma solidity ^0.4.13;
library Math {
function max64(uint64 a, uint64 b) internal pure returns (uint64) {
return a >= b ? a : b;
}
function min64(uint64 a, uint64 b) internal pure returns (uint64) {
return a < b ? a : b;
}
pragma solidity ^0.4.18;
import "zeppelin-solidity/contracts/crowdsale/Crowdsale.sol";
import "zeppelin-solidity/contracts/ownership/Ownable.sol";
contract LoomSale is Crowdsale, Ownable {
using SafeMath for uint256;
function LoomSale(uint256 _rate, address _wallet, ERC20 _loomTokenAddr) public
@mattkanwisher
mattkanwisher / Emit_solidity.sol
Created May 25, 2018 08:47
Emitting events in Solidity to be Indexed
pragma solidity ^0.4.0;
contract AccountReceipt {
event AccountCreated(
address indexed _from,
bytes32 indexed _id,
uint _value
);
function AccountReceipt(bytes32 _id) public payable {