Skip to content

Instantly share code, notes, and snippets.

In one terminal:

PORT=7777 go run main.go

In a separate terminal:

PORT=7778 JOIN=localhost:7777 go run main.go

Repeat as desired with additional ports, JOIN can point to one or more (comma-separated) existing nodes

@tjcelaya
tjcelaya / pandora_tls.sh
Created July 10, 2018 01:39 — forked from bonelifer/pandora_tls.sh
Replace Pandora's old tls fingerprint with new one in pianobar config
#!/bin/bash
##
## A simple little shell script that will return the current
## fingerprint on the SSL certificate and replace it in
## pianobar's config file automatically
##
## Author: William Jacoby (bonelifer) <>
##
## Base on the Github Gist by Bob Saska at: https://gist.github.com/r35krag0th/4173333
##
@tjcelaya
tjcelaya / fdns.sh
Last active July 8, 2018 02:53
fdns.sh - upserts blocks of hosts into /etc/hosts
#!/bin/bash
set -e
set -x
FDNS_HOSTS_FILE=${1:-.fdns}
FDNS_HOSTS_KEY=$(echo $FDNS_HOSTS_FILE | sed 's/[^a-zA-Z0-9]//g')
echo updating $FDNS_HOSTS_KEY block
@tjcelaya
tjcelaya / keybase.md
Created July 6, 2018 19:19
keybase.md

Keybase proof

I hereby claim:

  • I am tjcelaya on github.
  • I am tjcelaya (https://keybase.io/tjcelaya) on keybase.
  • I have a public key ASAOEm-3DKggzNpFTKkAs-ER9s4gS5z9mO5FlRyc164J4Ao

To claim this, I am signing this object:

DRY-RUN: Listing [405] tests that would have run
com.joyent.manta.client.MantaClientDirectoriesIT.canCreateDirectory
com.joyent.manta.client.MantaClientDirectoriesIT.canDeleteDirectory
com.joyent.manta.client.MantaClientDirectoriesIT.canRecursivelyCreateDirectory
com.joyent.manta.client.MantaClientDirectoriesIT.directoryIsMarkedAsSuch
com.joyent.manta.client.MantaClientDirectoriesIT.noErrorWhenWeOverwriteAnExistingFile
com.joyent.manta.client.MantaClientDirectoriesIT.willReturnFalseWhenWeOverwriteDirectory
com.joyent.manta.client.MantaClientDirectoriesIT.wontErrorWhenWeCreateOverAnExistingDirectory
com.joyent.manta.client.MantaClientErrorIT.badHomeDirectory
com.joyent.manta.client.MantaClientErrorIT.fileNotFoundWithContent
@tjcelaya
tjcelaya / 01-deserialization_exception.md
Last active July 25, 2019 04:40
kryo serialization bug, based off of java-manta-examples/src/main/java/ClientEncryptionServerMultipart.java

If you run App.java with the "all" argument you should get no errors. "all-with-serialization" also works because the pointer-to-native-memory that gets serialized is still valid as long as the JVM doesn't terminate.

If you run App.java once with "initiate" and then subsequently with "complete" you will receive the following exception only if libnss is in use:

Exception in thread "main" com.esotericsoftware.kryo.KryoException: Error during Java deserialization.
Serialization trace:
sessionRef (sun.security.pkcs11.Session)
session (sun.security.pkcs11.SessionKeyRef)
sessionKeyRef (sun.security.pkcs11.P11Key$P11SecretKey)
@tjcelaya
tjcelaya / MantaConfigInspectingApp.java
Last active May 25, 2017 04:38
ConfigContexts Lacking defaults for `noAuth` and `disableNativeSignatures`
package co.tjcelaya.sandbox;
import com.joyent.manta.config.*;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
public class App {
@tjcelaya
tjcelaya / MantaClientByteRangeRunner.java
Created May 24, 2017 22:40
Demonstrate requesting byte ranges from encrypted objects in Manta
package co.tjcelaya.sandbox;
import com.joyent.manta.client.MantaClient;
import com.joyent.manta.client.MantaObjectResponse;
import com.joyent.manta.client.crypto.AesCtrCipherDetails;
import com.joyent.manta.client.crypto.SecretKeyUtils;
import com.joyent.manta.config.*;
import com.joyent.manta.http.MantaHttpHeaders;
import org.apache.commons.io.IOUtils;
@tjcelaya
tjcelaya / .bashrc
Last active May 21, 2017 22:59
shortcuts for the laziest of the lazy
function aq {
# provide the column number ($1) to awk, and optionally the column separator ($2)
local fs=$( [ $# -ge 2 ] && echo "-F'$2'")
eval awk "$fs" "'{print \$$1}'"
}
function port-clear {
# slaughter whatever process is on port number ($1)
netstat -plnt | grep ":$1" | awk '{ split($NF,pd,"/"); print pd[1] }' | xargs kill -9