Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Dec 2020 ATX! Restoring a VW, setting-up apartment, starting PPG

BA steakknife

💭
Dec 2020 ATX! Restoring a VW, setting-up apartment, starting PPG
View GitHub Profile
View rust-in-large-organizations-notes.md

Rust in Large Organizations

Initially taken by Niko Matsakis and lightly edited by Ryan Levick

Agenda

  • Introductions
  • Cargo inside large build systems
  • FFI
  • Foundations and financial support
@steakknife
steakknife / afl-fuzz-for-ruby.rb
Created Sep 3, 2019
Homebrew formula for use with afl-ruby
View afl-fuzz-for-ruby.rb
class AflFuzzForRuby < Formula
desc "American fuzzy lop: Security-oriented fuzzer"
homepage "http://lcamtuf.coredump.cx/afl/"
url "http://lcamtuf.coredump.cx/afl/releases/afl-2.52b.tgz"
sha256 "43614b4b91c014d39ef086c5cc84ff5f068010c264c2c05bf199df60898ce045"
patch :p0 do
url "https://raw.githubusercontent.com/richo/afl-ruby/master/afl-fuzz.c.patch"
sha256 "14488f706ae2dd6d3de0a7962fc199446350c4eb5587dd76f08c0e193aebf538"
end
@steakknife
steakknife / read_write.rs
Created Aug 24, 2019
Dumb read/write trait requiring mutable self in Rust
View read_write.rs
pub trait Read<T> {
fn read(&mut self) -> T;
}
pub trait Write<T> {
fn write(&mut self, new_val: T);
}
pub trait ReadWrite<T>: Read<T> + Write<T> {}
@steakknife
steakknife / GNUmakefile
Last active Aug 24, 2019
GNU makefile for running rust playground on macOS locally
View GNUmakefile
### Prerequisite commands
#
# xcode-select --install
# /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# brew update
# brew install node@10 yarn rustup-init
# brew cask install docker
# open -a Docker
# rustup-init -y --default-toolchain stable
@steakknife
steakknife / up_down.rs
Created Aug 22, 2019
Rust upcasting and downcasting
View up_down.rs
use std::any::Any;
trait Upcast: Any {
fn as_any_ref(&self) -> &dyn Any;
}
struct Implementor {}
impl Implementor {
pub fn foo(&self) {
@steakknife
steakknife / demo.rs
Created Aug 22, 2019
Demo of implementing common traits on built-in Rust types
View demo.rs
///! See also: https://stackoverflow.com/questions/27932655/how-can-i-write-a-generic-function-that-discriminates-between-signed-and-unsigne
trait Int: PartialEq + PartialOrd + Sized {
fn min_value() -> Self;
fn zero() -> Self;
}
macro_rules! impl_int {
($t:ty) => {
impl Int for $t {
@steakknife
steakknife / ver
Last active Jul 26, 2019
macOS: Get version of an app from the command-line
View ver
#!/usr/bin/env ruby
require "cfpropertylist" # gem install CFPropertyList
module MacOS
module Ver
def self.info_plist_file_for_app(app)
File.join("/", "Applications", "#{app}.app", "Contents", "Info.plist")
end
def self.info_plist_for_app(app)
View patches.list
https://gist.githubusercontent.com/steakknife/946f6ee331512a269145b293cbe898cc/raw/bzip2-1.0.6-install_docs-1.patch
https://gist.githubusercontent.com/steakknife/eceda09cae0cdb4900bcd9e479bab9be/raw/bzip2recover-CVE-2016-3189.patch
https://gist.githubusercontent.com/steakknife/42feaa223adb4dd7c5c85f288794973c/raw/bzip2-man-page-location.patch
https://gist.githubusercontent.com/steakknife/94f8aa4bfa79a3f896a660bf4e973f72/raw/bzip2-shared-make-install.patch
https://gist.githubusercontent.com/steakknife/4faee8a657db9402cbeb579279156e84/raw/bzip2-pkg-config.patch
View bzip2-pkg-config.patch
diff --git a/Makefile b/Makefile
index 11bc446..1b8f964 100644
--- a/Makefile
+++ b/Makefile
@@ -12,6 +12,8 @@
# in the file LICENSE.
# ------------------------------------------------------------------
+VERSION=1.0.6
+
View bzip2-shared-make-install.patch
diff --git a/Makefile-libbz2_so b/Makefile-libbz2_so
index e58791b..1f0739b 100644
--- a/Makefile-libbz2_so
+++ b/Makefile-libbz2_so
@@ -26,6 +26,9 @@ CC=gcc
BIGFILES=-D_FILE_OFFSET_BITS=64
CFLAGS=-fpic -fPIC -Wall -Winline -O2 -g $(BIGFILES)
+# Where you want it installed when you do 'make install'
+PREFIX=/usr/local