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 /
Created Feb 9, 2017
Create an RBAC policy with ALL rules (for testing)
sdc-policy create --name='kitchensink' --rules='can putdirectory' --rules='can getdirectory' --rules='can deletedirectory' --rules='can putobject' --rules='can getobject' --rules='can deleteobject' --rules='can putlink' --rules='can createjob' --rules='can listjobs' --rules='can getjob' --rules='can managejob' --rules='can getaccount' --rules='can updateaccount' --rules='can listkeys' --rules='can getkey' --rules='can createkey' --rules='can deletekey' --rules='can listusers' --rules='can getuser' --rules='can createuser' --rules='can updateuser' --rules='can changeuserpassword' --rules='can deleteuser' --rules='can listroles' --rules='can getrole' --rules='can createrole' --rules='can updaterole' --rules='can deleterole' --rules='can setroletags' --rules='can listpolicies' --rules='can getpolicy' --rules='can createpolicy' --rules='can updatepolicy' --rules='can deletepolicy' --rules='can listuserkeys' --rules='can getuserkey' --rules='can createuserkey' --rules='can deleteuserkey' --rules='can listdatacente
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;
You can’t perform that action at this time.