Skip to content

Instantly share code, notes, and snippets.

Sam Chrisinger samchrisinger

Block or report user

Report or block samchrisinger

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
@samchrisinger
samchrisinger / travis.md
Created May 19, 2016
Your Own Personal Travis
View travis.md
  1. Create a Travis CI account
  2. Go to your profile page
  3. Find your fork of osf.io (mine is samchrisinger/osf.io), flip the toggle to make it green
  4. Click the little gear. Make sure "Build pushes" is active. Maybe set "Build pull requests" too.
  5. Push any code to your fork of osf.io, Travis runs your tests without cluttering the CenterForOpenScience build queue.
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>jQuery Experimenter Interface</title>
</head>
<body>
<select id="exp"></select>
<select id="session"></select>
@samchrisinger
samchrisinger / .generate_invoke_completion.py
Created Nov 13, 2015
bash autocomplete for OSF invoke tasks
View .generate_invoke_completion.py
def main():
f = open('tasks.py', 'r')
tasks = []
lines = f.read().split('\n')
f.close()
for i in range(len(lines)):
line = lines[i]
if '@task' in line:
opt = lines[i + 1].replace('def ', '').split('(')[0]
tasks.append(opt)
View gist:b1171abef9c89e2b14c2
#!/bin/bash
# from http://davidsj.co.uk/blog/delete-queues-in-rabbitmq/
for queue in `rabbitmqadmin -f bash list queues`; do echo $queue `rabbitmqadmin delete queue name=$queue`; done
@samchrisinger
samchrisinger / limits.sh
Last active Aug 29, 2015
Script for fixing "Too many open files" with Mongodb
View limits.sh
#!/bin/bash
sudo launchctl limit maxfiles 8096 8096
sudo launchctl limit maxproc 8096 8096
ulimit -n 8096
ulimit -u 1024
@samchrisinger
samchrisinger / commit_message_template
Last active Jul 10, 2017
Git commit message template
View commit_message_template
# Is this WIP or a minor change?
# [skip ci]
# Are you ready to indicate a related Jira issue?
# [#OSF- ]
# Style guidelines
# ----------------
# Capitalized, short (50 chars or less) summary
#
View gist:17153672d721dea8bd13
from __future__ import print_function
import uuid
import time
from datetime import datetime
fts = datetime.fromtimestamp
from webbrowser import open_new_tab
from random import randint
from requests.exceptions import ConnectionError
View gist:5920e2aeb93abbf9d316
from __future__ import print_function
import uuid
import time
from datetime import datetime
fts = datetime.fromtimestamp
from webbrowser import open_new_tab
from random import randint
from requests.exceptions import ConnectionError
@samchrisinger
samchrisinger / gist:7491189
Created Nov 15, 2013
jQuery form serialize
View gist:7491189
$('#submit').on('click', function(e){
e.preventDefault(); //IMPORTANT-- you must stop the form from automatically sending a POST request
var obs = $('#observer_form').serializeArray();
var met = $('#metrics_form').serializeArray();
var site = $('#site_form').serializeArray()
});
// This returns three arrays of objects like {name:NAME, value:VALUE}. This is grabbing the HTML name attribute of the form contents as well at their values. I've added check boxes next to my <input> tags so blank fields don't get submitted. This looks something like:
$('.toggle').on('change', function(){
@samchrisinger
samchrisinger / gist:7436061
Created Nov 12, 2013
using HTTPS with jQuery for mobile login
View gist:7436061
$('#loginsubmit').on('click', function(){
$.post('https://pegasus.cs.virginia.edu/rcs/tokens.json',
{email: $('#email').val(),
password: $('#password').val()},
function(res){
console.log(res.token);
}).error(function(err){
console.log(err);
});
});
You can’t perform that action at this time.