Skip to content

Instantly share code, notes, and snippets.

View raffecat's full-sized avatar

Raffe raffecat

  • Melbourne, Australia
View GitHub Profile
@raffecat
raffecat / pratt.js
Created April 27, 2024 04:55
Pratt parser practical example
// Pratt parser practical example.
var source = "c^2 > 1-2+3 + d(4) * -(a+1) + 8 * -5^4^3^2 + 1";
var pos = 0;
var unary_precedence = 4
var precedence = {
'=': 1, // equality
'<': 1,
'>': 1,
@raffecat
raffecat / rebase.sh
Created July 27, 2023 01:49
Git rebase to fix up author information on commits
# Git rebase is a weird 3-way thing that compares local commits to upstream commits.
# Yes really. So if you just want to edit some local commits, you need an upstream
# branch with exactly the same commits on it, to avoid git doing weird stuff.
# There doesn't seem to be any "local only" option in git rebase.
git config user.name 'Full Name'
git config user.email 'person@example.com'
git branch temp-1
# this is the critical step:
git push -u origin temp-1
# git rebase -i --root --exec "git commit --amend --reset-author --no-edit"
@raffecat
raffecat / log.txt
Last active May 4, 2023 07:33
Build Dogecoin Core on Ubuntu Jammy 22.04 (WSL2)
sudo apt update
sudo apt upgrade
git clone git@github.com:dogecoin/dogecoin.git
cd dogecoin
sudo apt-get install build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils
sudo apt-get install libminiupnpc-dev
sudo apt-get install libzmq3-dev
@raffecat
raffecat / log.txt
Last active February 7, 2023 01:32
Build Gigawallet on M1 Mac 7 Feb 2023
mkdir temp
cd temp
git clone git@github.com:dogecoinfoundation/libdogecoin.git
git clone git@github.com:dogeorg/go-libdogecoin.git
git clone git@github.com:dogecoinfoundation/gigawallet.git
cd libdogecoin
git checkout 0.1.1-dogeathon
./autogen.sh
@raffecat
raffecat / flutter.MD
Last active January 31, 2023 04:38
Flutter installation on M1 Mac Monterey 12.6.2
@raffecat
raffecat / doge-core-m1.sh
Last active November 14, 2022 06:12
Building Dogecoin Core on M1 mac
# MacBook Air M1 2020, macOS 12.5.1 Monterey, XCode 14.1
# https://github.com/dogecoin/dogecoin/blob/master/doc/Building-Dogecoin-1.14-for-Mac.md
# https://github.com/dogecoin/dogecoin/blob/master/doc/build-osx.md
git clone git@github.com:dogecoin/dogecoin.git
cd dogecoin
git checkout tags/v1.14.6
brew install boost --build-from-source --HEAD # per Building-Dogecoin-1.14-for-Mac.md
@raffecat
raffecat / git-setup.sh
Created January 2, 2022 05:38
Git Setup
git config --global user.name "My Name"
git config --global user.email "myname@gmail.com"
git config --global core.autocrlf false
git config --global core.filemode false
git config --global branch.autosetuprebase always
git config --global pull.rebase true
git config --global fetch.prune true # local inaccessible objects
git config --global diff.colorMoved zebra # show "moved" lines
@raffecat
raffecat / pymem.py
Created August 8, 2021 10:40
Effect of cache-unfriendly array access in python
import time
import random
size = 1000000 # more zeros, more difference
nums = list(range(size))
inds = list(range(size))
# reset cache
sum(nums)
@raffecat
raffecat / groovy@2.rb
Created February 18, 2020 03:06
brew install groovy@2 # /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/groovy@2.rb
class GroovyAT2 < Formula
desc "Java-based scripting language"
homepage "https://www.groovy-lang.org/"
url "https://dl.bintray.com/groovy/maven/apache-groovy-binary-2.5.9.zip"
sha256 "fea7dc321a3029c47ffa4aa165055d2bcc78bc280fac4e70ac131c717e45b89b"
bottle :unneeded
keg_only :versioned_formula
@raffecat
raffecat / rollup.config.js
Created March 23, 2019 09:44
Rollup Config for Buble with ESLint
import eslint from 'rollup-plugin-eslint';
import buble from 'rollup-plugin-buble';
export default {
input: 'src/entry.js',
output: {
file: 'dist/bundle.js',
format: 'iife'
},
plugins: [