Skip to content

Instantly share code, notes, and snippets.

@wilsoncusack
wilsoncusack / DecimalStrings.sol
Last active February 28, 2023 06:24
Solidity Decimal String Helpers
function decimalString(uint256 number, uint8 decimals, bool isPercent) private pure returns(string memory){
uint8 percentBufferOffset = isPercent ? 1 : 0;
uint256 tenPowDecimals = 10 ** decimals;
uint256 temp = number;
uint8 digits;
uint8 numSigfigs;
while (temp != 0) {
if (numSigfigs > 0) {
// count all digits preceding least significant figure
@17twenty
17twenty / default.conf
Last active March 12, 2018 12:35
Websocket Nginx Configuration with Go App
server {
listen 80;
server_name goapp-server.curiola.com;
location / {
proxy_pass http://websocket;
proxy_http_version 1.1;
proxy_redirect off;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
@agnoster
agnoster / README.md
Last active March 10, 2025 15:41
My ZSH Theme

agnoster.zsh-theme

A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

For Mac users, I highly recommend iTerm 2 + Solarized Dark

@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active March 20, 2025 09:05
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh