Skip to content

Instantly share code, notes, and snippets.

View claytantor's full-sized avatar
💭
Doing and Being

Clay Graham claytantor

💭
Doing and Being
View GitHub Profile
@claytantor
claytantor / jq-original-gravity.js
Last active August 29, 2015 13:55
Jquery Original Gravity
$('#btn_og').click(function() {
//get form values
temp_val = $('#og_wort_temp').val();
og_val = $('#og_value').val();
actual_og = $('#og_actual').val();
t2 = 1.34722124e-4*temp_val;
t3 = 2.04052596e-6*temp_val*temp_val;
t4 = 2.32820948e-9*temp_val*temp_val*temp_val;
package com.claytantor.mahout.test.app;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.mahout.classifier.sgd.L1;
import org.apache.mahout.classifier.sgd.OnlineLogisticRegression;
import org.apache.mahout.math.DenseVector;
@claytantor
claytantor / coinbase_http.py
Last active August 29, 2015 14:00
python coinbase http call
# there is a problem with the coinbase python example
# at https://coinbase.com/docs/api/authentication where they
# fail to add the content type header to the POST action
# this is the actual implementation
def get_http(self, url, body=None):
opener = urllib2.build_opener()
nonce = int(time.time() * 1e6)
message = str(nonce) + url + ('' if body is None else body)
signature = hmac.new(settings.COINBASE_API_SECRET, message, hashlib.sha256).hexdigest()
@claytantor
claytantor / apache-ssl01.sh
Last active August 29, 2015 14:03
Making Apache 2 SSL
#make sure the module is not there yet
/usr/sbin/apachectl -t -D DUMP_MODULES
#install ssl
sudo yum install openssl-devel
#get and build apache 2 based on your version
cd src
/usr/sbin/apachectl -v
wget http://www.eng.lsu.edu/mirrors/apache//httpd/httpd-2.2.27.tar.gz
@claytantor
claytantor / gist:dd25a654f9a1f10a343d
Created July 5, 2014 17:36
apache2-wsgi-ssl-http.conf
<VirtualHost gitpatron.com:443>
ServerAdmin admin@gitpatron.com
ServerName gitpatron.com
SSLEngine on
SSLCertificateKeyFile /etc/ssl/certs/gitpatron.key
SSLCertificateFile /etc/ssl/certs/gitpatron_com.crt
SSLCertificateChainFile /etc/ssl/certs/gitpatron_com.ca-bundle
</VirtualHost>
@claytantor
claytantor / scene1.json
Last active August 29, 2015 14:04
looking to create a scene graph for three.js and jquery
{
"scene":{
"renderer":{
"id":"main-renderer",
"type":"WebGLRenderer",
"alpha":true
},
"cameras":[
{
"id":"camera1",
@claytantor
claytantor / gldev.jquery.js
Created July 20, 2014 20:09
simple threejs plugin for jquery.
// RequestAnimationFrame shim - Source: http://paulirish.com/2011/requestanimationframe-for-smart-animating/
window.requestAnimFrame = ( function( callback ) {
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function ( callback ) {
window.setTimeout( callback, 1000 / 60 );
};
@claytantor
claytantor / gldev4.html
Created August 6, 2014 00:39
single page simulation
<!DOCTYPE html>
<html>
<head>
<title>P5</title>
<script src="{{ STATIC_URL }}js/jquery-1.11.1.min.js"></script>
<script src="{{ STATIC_URL }}js/jquery-ui-core.min.js"></script>
<script src="{{ STATIC_URL }}js/three.js"></script>
<script src="{{ STATIC_URL }}js/gldev.jquery.js"></script>
<script>
$( document ).ready(function() {
@claytantor
claytantor / gist:e789334a76d48c2da504
Created October 20, 2014 05:07
Command Line curl JSON
curl -H "Content-Type: application/json" -d '{"username":"xyz","password":"xyz"}' http://localhost:3000/api/login
@claytantor
claytantor / gist:dfc58203690de7ebbec2
Last active August 29, 2015 14:08
Reset your postgres user password
[ec2-user@ip-10-45-187-20 ~]$ pg_config
BINDIR = /usr/bin
DOCDIR = /usr/share/doc/pgsql
HTMLDIR = /usr/share/doc/pgsql
INCLUDEDIR = /usr/include
PKGINCLUDEDIR = /usr/include/pgsql
INCLUDEDIR-SERVER = /usr/include/pgsql/server
LIBDIR = /usr/lib64
PKGLIBDIR = /usr/lib64/pgsql
LOCALEDIR = /usr/share/locale