Skip to content

Instantly share code, notes, and snippets.

@PJK
PJK / keybase.md
Created January 30, 2019 21:35
keybase.md

Keybase proof

I hereby claim:

  • I am pjk on github.
  • I am pjk (https://keybase.io/pjk) on keybase.
  • I have a public key whose fingerprint is 2058 675D 5358 EA23 7578 C28E 794A FAB4 1942 97E1

To claim this, I am signing this object:

@PJK
PJK / gist:c3c9bcaf327c402d456c761bd674a0a5
Last active January 27, 2019 13:45
homebrew libcbor
⇒ brew install -v libcbor
==> Installing libcbor from pjk/libcbor
/usr/bin/sandbox-exec -f /private/tmp/homebrew20190127-85504-ysiouo.sb nice /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -W0 -I /usr/local/Homebrew/Library/Homebrew/vendor/bundle-standalone/bundler/../ruby/2.3.0/gems/ruby-macho-2.1.0/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle-standalone/bundler/../ruby/2.3.0/gems/rubocop-rspec-1.31.0/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle-standalone/bundler/../ruby/2.3.0/gems/rubocop-0.63.1/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle-standalone/bundler/../ruby/2.3.0/gems/unicode-display_width-1.4.1/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle-standalone/bundler/../ruby/2.3.0/gems/ruby-progressbar-1.10.0/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle-standalone/bundler/../ruby/2.3.0/gems/rainbow-3.0.0/lib:/usr/local/Homebrew/Library/Homebrew/vendor/bundle-standalone/bundler/../ruby/2.3.0/gems/powerpack-0.1.2/lib:/usr/local/Homebrew/
fn sgn(x: i32) -> i32 {
match x {
y if y < 0 => -1,
y if y == 0 => 0,
y if y > 0 => 1,
}
}
fn main() {}
pavel@dt3:~|⇒ brew --version
==> Downloading https://homebrew.bintray.com/bottles-portable/portable-ruby-2.3.3.leopard_64.bottle.1.tar.gz
curl: (22) The requested URL returned error: 404 Not Found
Error: Download failed: https://homebrew.bintray.com/bottles-portable/portable-ruby-2.3.3.leopard_64.bottle.1.tar.gz
Error: Failed to install vendor Ruby.
[1] 66760 exit 1 brew --version
pavel@dt3:~|⇒ brew update
==> Downloading https://homebrew.bintray.com/bottles-portable/portable-ruby-2.3.3.leopard_64.bottle.1.tar.gz
g6Rib2R5hqhkZXRhY2hlZMOpaGFzaF90eXBlCqNrZXnEIwEgjTrRSEK3LmS+8rwTP6YayPh7qxnAqBQWkVUz4P0SF3cKp3BheWxvYWTFAuJ7ImJvZHkiOnsia2V5Ijp7ImVsZGVzdF9raWQiOiIwMTIwOGQzYWQxNDg0MmI3MmU2NGJlZjJiYzEzM2ZhNjFhYzhmODdiYWIxOWMwYTgxNDE2OTE1NTMzZTBmZDEyMTc3NzBhIiwiaG9zdCI6ImtleWJhc2UuaW8iLCJraWQiOiIwMTIwOGQzYWQxNDg0MmI3MmU2NGJlZjJiYzEzM2ZhNjFhYzhmODdiYWIxOWMwYTgxNDE2OTE1NTMzZTBmZDEyMTc3NzBhIiwidWlkIjoiZjY4ZmVjMTAzNTU2ZTZiNDE5YmYxYjU1ODdhZTBiMTkiLCJ1c2VybmFtZSI6InBqayJ9LCJzZXJ2aWNlIjp7Im5hbWUiOiJnaXRodWIiLCJ1c2VybmFtZSI6InBqayJ9LCJ0eXBlIjoid2ViX3NlcnZpY2VfYmluZGluZyIsInZlcnNpb24iOjF9LCJjbGllbnQiOnsibmFtZSI6ImtleWJhc2UuaW8gZ28gY2xpZW50IiwidmVyc2lvbiI6IjEuMC4xNSJ9LCJjdGltZSI6MTQ2MTQyNTM0OSwiZXhwaXJlX2luIjo1MDQ1NzYwMDAsIm1lcmtsZV9yb290Ijp7ImN0aW1lIjoxNDYxNDI1MzM4LCJoYXNoIjoiYTBjYmQ5MTk4OTZkNzg4ZGEyZjdjMzI4OWFkNjEwOTYyZWE4Mzg3MDZjZTZiOGEyYTM3OWJiNTliNTY1NzczM2JjZTQ4MTMwOTNhMTczMmEzNTk2YjBkZWFhMWJmZTcxN2Q4OTViNWU2MThkMjQ5M2NhNDRhMTdkMTM0YzYwMDciLCJzZXFubyI6NDQ5Njg5fSwicHJldiI6IjQxM2FjMGZkYjlmNjE1NTYxMTVhNzQwYzNiYWEzYThjNzU4OTE3ZTRkZmQ2
@PJK
PJK / _readme.md
Last active October 2, 2019 12:44
ETH Systems Construction 2015
#include <cbor.h>
#include <stdio.h>
int main(int argc, char * argv[])
{
/* Preallocate the map structure */
cbor_item_t * root = cbor_new_definite_map(2);
/* Add the content */
cbor_map_add(root, (struct cbor_pair) {
.key = cbor_move(cbor_build_string("Is CBOR awesome?")),
@PJK
PJK / ex.c
Last active August 29, 2015 14:21
libcbor example
#include "cbor.h"
int main(int argc, char * argv[])
{
/* Preallocate the map structure */
cbor_item_t * root = cbor_new_definite_map(2);
/* Add the content */
cbor_map_add(root, (struct cbor_pair) {
.key = cbor_move(cbor_build_string("Is CBOR awesome?")),
.value = cbor_move(cbor_build_bool(true))
@PJK
PJK / Make
Created May 3, 2015 11:59
Latex citations with URL dates
$(NAME).bbl: $(BIB) $(NAME).tex
pdflatex -shell-escape $(PDFL_FLAGS) $(NAME)
biber $(NAME)
module Libcbor
extend FFI::Library
ffi_lib ['/usr/local/lib/libcbor.so']
attach_function :cbor_new_int8, [], :pointer
attach_function :cbor_set_uint16, [:pointer, :ushort], :void
attach_function :cbor_set_uint8, [:pointer, :uchar], :void
attach_function :cbor_serialize, [:pointer, :pointer, :size_t], :size_t
puts 'yo'
end