Skip to content

Instantly share code, notes, and snippets.

View crtlib's full-sized avatar

Paul Kofmann crtlib

View GitHub Profile
@andris9
andris9 / onion.js
Created March 24, 2021 12:43
Generate onion v3 address from ed25519 public key
// npm install hi-base32 sha3
const base32 = require("hi-base32");
const { SHA3 } = require("sha3");
function verifyOnionAddress(addr) {
const suffixLength = ".onion".length;
if (!/\.onion$/i.test(addr) || addr.length != 56 + suffixLength) {
return false;
}
@subfuzion
subfuzion / curl.md
Last active May 3, 2024 09:26
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@xrstf
xrstf / letsencrypt.md
Last active April 18, 2023 05:01
Let's Encrypt on Ubuntu 14.04, nginx with webroot auth

Let's Encrypt on Ubuntu 14.04, nginx with webroot auth

This document details how I setup LE on my server. Firstly, install the client as described on http://letsencrypt.readthedocs.org/en/latest/using.html and make sure you can execute it. I put it in /root/letsencrypt.

As it is not possible to change the ports used for the standalone authenticator and I already have a nginx running on port 80/443, I opted to use the webroot method for each of my domains (note that LE does not issue wildcard certificates by design, so you probably want to get a cert for www.example.com and example.com).

Configuration

For this, I placed config files into etc/letsencrypt/configs, named after <domain>.conf. The files are simple:

@jamesmartin
jamesmartin / ci_artifacts.rb
Created July 8, 2015 00:50
Circle CI Build Artifact URIs for a given project/branch
require 'net/http'
require 'json'
if __FILE__ == $0
wanted_project = ARGV[0] || "my_project"
wanted_branch = ARGV[1] || "master"
puts "Latest CI Artifacts for #{wanted_project}:"
api_root = "https://circleci.com/api/v1/"
android.libraryVariants.all { variant ->
def name = variant.buildType.name
if (name.equals(com.android.builder.core.BuilderConstants.DEBUG)) {
return; // Skip debug builds.
}
def task = project.tasks.create "jar${name.capitalize()}", Jar
task.dependsOn variant.javaCompile
//Include Java classes
task.from variant.javaCompile.destinationDir
//Include dependent jars with some exceptions
@stephenlb
stephenlb / parse-cloud-publish-to-pubnub.js
Last active September 28, 2016 09:20
Combining Parse API with PubNub Realtime Messaging - By combining the Parse API with PubNub Data Streams you will have a better starting point rather than building a custom backend from scratch.
var pubnub = {
'publish_key' : 'demo',
'subscribe_key' : 'demo'
};
var bob_channel = "channel-bob";
var sally_channel = "channel-sally";
var message = {
"from" : "Sally",
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active February 12, 2024 17:18
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

OBSOLETE

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

@clayrichardson
clayrichardson / change_phabricator_prefix.rb
Created February 1, 2014 04:11
Script to migrate phabricator database prefixes
require 'ostruct'
require 'optparse'
require 'awesome_print'
$stdout.sync = true
options = {}
OptionParser.new do |opts|
opts.banner = "Usage: change_phabricator_prefix.rb [options]"
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active May 3, 2024 12:59
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@jonathandixon
jonathandixon / .gitignore
Last active January 5, 2021 22:01
Cordova CLI project .gitignore and helper script. Useful when you don't want to commit the platforms and plugins directories to version control. http://stackoverflow.com/q/17911204/417568
platforms/
plugins/