Skip to content

Instantly share code, notes, and snippets.

@bowlercaptain
bowlercaptain / listNonMutuals.py
Last active October 17, 2018 23:00
a script to list people who you don't follow / don't follow you on mastodon.
#!/usr/bin/env python
from mastodon import Mastodon
import os.path
instanceBaseURL = "https://cybre.space"
if ( not os.path.isfile("nonMutuals_clientcred.secret")):
Mastodon.create_app(
'nonMutuals',
/*
Quick SDL2 wrapper for uPNG
d@revenant1.net
This code is public domain.
*/
// https://github.com/elanthis/upng
#include "upng/upng.h"
#include <SDL2/SDL.h>
@orlp
orlp / chacha.h
Last active August 18, 2025 14:08
C++11 ChaCha implementation.
/*
Copyright (c) 2024 Orson Peters <orsonpeters@gmail.com>
This software is provided 'as-is', without any express or implied warranty. In no event will the
authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial
applications, and to alter it and redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the
/*
IMPORTANT!!! DO NOT USE THIS. It works, but you'll probably get it wrong,
because it must be keyed with at least 128 bits of entropy, and where
do you get this entropy, huh?
- In a browser, you get it from window.crypto.getRandomValues().
- In Node, you get it from crypto.randomBytes()
Now LOOK AT YOU! You already have secure ways to generate random bytes,
@dsamarin
dsamarin / Complex.js
Created October 3, 2011 03:11
Complex numbers in JavaScript
var Complex = function(real, imag) {
if (!(this instanceof Complex)) {
return new Complex (real, imag);
}
if (typeof real === "string" && imag == null) {
return Complex.parse (real);
}
this.real = Number(real) || 0;
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active October 27, 2025 08:27
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