Skip to content

Instantly share code, notes, and snippets.

@brycefisher
brycefisher / bash-output.txt
Created March 21, 2014 19:25
neovim/neovim manual build output
$ make cmake
rm -rf build
make -C src/testdir clean
rm -rf *.out *.failed *.rej *.orig test.log test.out X* viminfo tiny.vim small.vim mbyte.vim mzscheme.vim lua.vim test.ok valgrind.*
make -C test/includes clean
rm -rf post
sh -e scripts/setup-test-tools.sh
Checking Lua includes...
lua.h found in /Users/bfisher-fleig/Desktop/neovim/.deps/usr/include/luajit-2.0/lua.h
curl found at /usr/bin
@brycefisher
brycefisher / convert.php
Created March 27, 2014 04:30
Extracts a several of fields that were put into the same cell and outputs a CSV
<?php
// Open the munged file
$in_fp = fopen('CarenChengWordList.csv','r');
while ($row = fgetcsv($in_fp)) {
// Separate out the data in the 3rd column into 3 fields
list($messy_fields, $sentence) = explode("\n", $row[2]);
$period_index = stripos($messy_fields, '.');
$part_of_speech = substr($messy_fields, 0, $period_index);
$definition = substr($messy_fields, $period_index + 1);
@brycefisher
brycefisher / update-rust.sh
Created April 28, 2014 15:25
Update Rust Compiler
#!/bin/sh
curl http://static.rust-lang.org/dist/rust-nightly-x86_64-unknown-linux-gnu.tar.gz >> rust-nightly.tar.gz
tar xvf rust-nightly.tar.gz
cd rust-nightly-x86_64-unknown-linux-gnu
./install.sh
cd ..
rm -rf rust-nightly-x86_64-unknown-linux-gnu
rm rust-nightly.tar.gz
@brycefisher
brycefisher / alrt.js
Created May 29, 2014 19:58
google xss
alert()
echo "BOOTSTRAP: Update apt-get"
sudo apt-get update -y
echo "BOOTSTRAP: Install some utilities"
sudo apt-get install -y curl git
echo "BOOTSTRAP: Install FFMPEG"
sudo apt-get install -y ffmpeg
echo "BOOTSTRAP: Install mysql server"
### Keybase proof
I hereby claim:
* I am brycefisher on github.
* I am bff (https://keybase.io/bff) on keybase.
* I have a public key whose fingerprint is C5B5 A620 A9FE 0471 0B82 C3DE 7164 981B 336A 2F68
To claim this, I am signing this object:
@brycefisher
brycefisher / enums.rs
Created November 30, 2014 19:26
Namespaced Enums
// Enum syntax has changed.
// Given this enum:
enum Shapes {
Circle,
Square
}
// WORKS
let drawing = Shapes::Circle;

General

  • Are all vars used somewhere?
  • Do the vars have properly cased, and meaningful names?
  • Style looks appropriate
  • No unnecessarily duplicated logic
  • Code intent is clear upon initial reading
  • Any code that isn't clear, but is needed, has an effective comment
  • Are method calls or attribute lookups every called on entities that could be undefined/null?
  • The functions can appropriately handle unexpected inputs.
  • Commented code has been removed (comments themselves are fine).
@brycefisher
brycefisher / gist:a152f084c8d7dee5612d
Created February 16, 2015 19:52
docker push failed to upload metadata EOF
user@local:~$ docker push localhost:5000/bryce/my_image
The push refers to a repository [localhost:5000/bryce/my_image] (len: 1)
Sending image list
Pushing repository localhost:5000/bryce/my_imagee (1 tags)
511136ea3c5a: Image successfully pushed
b18d0a2076a1: Pushing
FATA[0009] Failed to upload metadata: Put http://localhost:5000/v1/images/b18d0a2076a121ed25bee8188661264efb4703910ab84c67b1b1ebe12144c15b/json: EOF
use image::{GenericImage, ImageBuffer};
extern crate image;
pub fn sobel(input: GenericImage) -> Option<ImageBuffer> {
let (width, height) = input.dimensions();
let raw_input = input.grayscale().raw_pixels();
let mut raw_output = vec![0u8; width*height];
let kernel_x = &[