Skip to content

Instantly share code, notes, and snippets.

@giuseppeg
giuseppeg / fuzzbuzz.js
Last active July 6, 2022 08:55
FizzBuzz solution with just one comparison:Bitwise operations, using predefined 0-15 numbers masksource: http://www.zoharbabin.com/which-fizzbuzz-solution-is-the-most-efficient
// FizzBuzz solution with one comparison:
// Bitwise operations, using predefined 0-15 numbers mask
// live demo: http://jsfiddle.net/TbAuQ/
// source: http://www.zoharbabin.com/which-fizzbuzz-solution-is-the-most-efficient
var words = [undefined, "Fizz", "Buzz", "FizzBuzz"],
mask = 810092048, //11 00 00 01 00 10 01 00 00 01 10 00 01 00 00
c = 0;
@m5m1th
m5m1th / localPorts.sh
Last active May 27, 2020 04:57
Redirect port 3080/3443 to 80/443 for local dev
#Requests from outside
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 3080
iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-ports 3443
#Requests from localhost
iptables -t nat -I OUTPUT -p tcp -d 127.0.0.1 --dport 80 -j REDIRECT --to-ports 3080
iptables -t nat -I OUTPUT -p tcp -d 127.0.0.1 --dport 443 -j REDIRECT --to-ports 3443
@bergmannjg
bergmannjg / rearct-native-app-in-wsl2.md
Last active July 23, 2024 04:16
Building a react native app in WSL2
# Downloading the unsigned tarball
Desktop curl -O https://bitcoin.jonasschnelli.ch/bitcoin-osx-unsigned.tar.gz
shasum -a 256 bitcoin-osx-unsigned.tar.gz
5e3a08ae8195190d6f1b12e3e1e9d710e7ad385941a6e8d04e3391f12deddb11 bitcoin-osx-unsigned.tar.gz
# hash matches with other gitian builders
#unpacking
mkdir bitcoin-osx-unsigned
tar -xzf bitcoin-osx-unsigned.tar.gz -C bitcoin-osx-unsigned
cd bitcoin-osx-unsigned