Skip to content

Instantly share code, notes, and snippets.

@lorepozo
lorepozo / .gitignore
Last active April 16, 2018 06:10
Rust call Ocaml
/target
**/*.rs.bk
*.cmi
*.cmx
*.o
@lorepozo
lorepozo / Makefile
Last active April 16, 2018 04:20
Rust call C
default:
gcc -g -c foo.c -o foo.o
ar rcs libfoo.a foo.o
rustc main.rs -L .
@lorepozo
lorepozo / Cargo.toml
Last active April 7, 2018 16:12
Get kcov to handle rustdoc tests
[package]
name = "kcov_rustdoc"
version = "0.0.1"
[dependencies]
redhook = "0.1"
libc = "0.2"
[lib]
name = "kcov_rustdoc"
@lorepozo
lorepozo / nh-profit.sh
Created July 18, 2017 03:44
check your current profitability from nicehash
#!/bin/sh
# REQUIRES jq (https://stedolan.github.io/jq)
#
# This program, nh-profit, checks your current profitability from nicehash.
#
# Copyright 2017 Lucas Morales <lucas@lucasem.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
@lorepozo
lorepozo / mine.sh
Last active September 10, 2017 18:25
auto-switching best-profit GPU mining on GNU+Linux
#!/bin/sh
# REQUIRES jq (https://stedolan.github.io/jq)
# AND ccminer (https://github.com/tpruvot/ccminer)
# AND eqm (https://github.com/nicehash/nheqminer)
# (all in PATH)
#
# This program auto-switches miners for best profit.
#
# Copyright 2017 Lucas Morales <lucas@lucasem.com>
#
@lorepozo
lorepozo / zbalance.sh
Created March 31, 2017 19:52
zbalance: quickly get your zcash addresses (taddr and zaddr) and their balances
#!/bin/sh
# zbalance: quickly get your zcash addresses (taddr and zaddr) and their balances.
# REQUIRES zcash-cli (https://z.cash) AND jq (https://stedolan.github.io/jq)
zaddr_withbalance () {
while read a
do echo $(zcash-cli z_getbalance $a) $a
done
}
@lorepozo
lorepozo / install_vpn.sh
Last active April 22, 2020 04:39
automatically install and configure a VPN server — IKEv2 over IPsec
#!/bin/bash
# install_vpn.sh
# automatically install and configure a VPN -- IKEv2 over IPsec
# using strongswan and iptables
# Author: Lucas E Morales <lucas@lucasem.com>
#
# tested on Ubuntu 16.04 and arch 2018-07
#
# huge thanks to Namo's tutorial:
# https://www.digitalocean.com/community/tutorials/how-to-set-up-an-ikev2-vpn-server-with-strongswan-on-ubuntu-16-04
@lorepozo
lorepozo / Makefile
Last active December 7, 2017 19:29
Makefile for LaTeX
THIS_FILE := $(lastword $(MAKEFILE_LIST))
TEX := xelatex -shell-escape -interaction=nonstopmode -file-line-error
PRE := $(wildcard ./*.tex)
OBJ := $(PRE:%.tex=%.pdf)
BIB := $(wildcard ./*.bib)
BIB_OBJ := $(BIB:%.bib=%.bbl)
@lorepozo
lorepozo / c.h
Last active October 24, 2020 12:48
cocoa button with Golang callback
#include <Cocoa/Cocoa.h>
extern void ButtonClick(void);
@interface GoPasser : NSObject
+ (void)buttonClick:(id)sender; // this should call the cgo function defined in main.go
@end
void StartApp(void);