Skip to content

Instantly share code, notes, and snippets.

Travis Paul travispaul

Block or report user

Report or block travispaul

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
travispaul / mtest.c
Last active Dec 15, 2016
mmap /dev/mmem0.0c test
View mtest.c
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <unistd.h>
main(int argc, char **argv)
travispaul /
Last active Nov 15, 2016
Get users from CloudAPI using cURL
# Update these if your ssh keys exist in another location:
now=$(date -u "+%a, %d %h %Y %H:%M:%S GMT");
signature=$(echo ${now} | tr -d '\n' | openssl dgst -sha256 -sign $sshkey | openssl enc -e -a | tr -d '\n');
fingerprint=$(ssh-keygen -l -E md5 -f $sshpub | awk '{print $2}' | sed -e 's/MD5://')
curl -i -H "Accept: application/json" -H "accept-version: ~8" -H "Date: ${now}" -H "Authorization: Signature keyId=\"/$SDC_ACCOUNT/keys/${fingerprint}\",algorithm=\"rsa-sha256\" ${signature}" --url $SDC_URL/$SDC_ACCOUNT/users;
travispaul /
Last active Nov 15, 2016
Manta Write-only RBAC example

SubUser account with write-only permissions for directory

Useful for logs, backups, etc where it may not be desirable for the client to read files it has uploaded or other files within the upload directory.

Example policy and role for subuser:

$ sdc-policy create --name WriteOnly --rules "can putobject"
$ sdc-role create --name LogWriter --default-members mysubuser --members mysubuser --policies WriteOnly
travispaul / timertest.c
Created Nov 8, 2016
Create timers (until you can't)
View timertest.c
// Example:
// cc -lrt timertest.c
// ./a.out 128
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <signal.h>
#include <time.h>
travispaul / memcaptest.c
Last active Nov 8, 2016
Eat up memory (for testing memory caps)
View memcaptest.c
// example: ./a.out 10 1 150
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
int main(int argc, char **argv) {
int mbytes = atoi(argv[1]);
int seconds = atoi(argv[2]);
int limit = atoi(argv[3]);
int total = 0;
travispaul /
Last active Oct 3, 2016
Pid file is created before CouchDB is able to respond to HTTP requests.
# Get couchdb_password from metadata if exists, or use couchdb_pw, or set one.
log "getting couchdb_password"
if [[ $(mdata-get couchdb_password &>/dev/null)$? -eq "0" ]]; then
COUCHDB_PW=$(mdata-get couchdb_password 2>/dev/null);
mdata-put couchdb_pw ${COUCHDB_PW}
elif [[ $(mdata-get couchdb_pw &>/dev/null)$? -eq "0" ]]; then
COUCHDB_PW=$(mdata-get couchdb_pw 2>/dev/null);
COUCHDB_PW=$(od -An -N8 -x /dev/random | head -1 | tr -d ' ');
mdata-put couchdb_pw ${COUCHDB_PW}
View mget.php
$ mget ~~/
$ php mget.php ~~/
PHP Warning: openssl_sign(): supplied key param cannot be coerced into a private key in /Users/tpaul/Code/php-manta/src/MantaClient.php on line 372
travispaul / salt.patch
Created Feb 7, 2016
Update salt to 2015.8.5
View salt.patch
Index: Makefile
RCS file: /cvsroot/pkgsrc/sysutils/salt/Makefile,v
retrieving revision 1.34
diff -u -r1.34 Makefile
--- Makefile 4 Feb 2016 22:05:36 -0000 1.34
+++ Makefile 7 Feb 2016 23:33:54 -0000
@@ -1,7 +1,6 @@
# $NetBSD: Makefile,v 1.34 2016/02/04 22:05:36 khorben Exp $
View pthread.c
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <unistd.h>
#include <errno.h>
void *perform_work(void *argument)
int passed_in_value;
View salt.patch
commit ba76062950095850ec165be0be3584624da2046f
Author: Travis Paul <>
Date: Wed Dec 16 23:20:36 2015 +0000
sysutils/salt: Fix cron module for SmartOS
Upstream PR sent:
diff --git a/sysutils/salt/Makefile b/sysutils/salt/Makefile
index 2cd7c5a..67cdc71 100644
You can’t perform that action at this time.