Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Doing and Being

Clay Graham claytantor

💭
Doing and Being
View GitHub Profile
@claytantor
claytantor / jq-original-gravity.js
Last active Aug 29, 2015
Jquery Original Gravity
View jq-original-gravity.js
$('#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;
View Mahout LR Example
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 Aug 29, 2015
python coinbase http call
View coinbase_http.py
# 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 Aug 29, 2015
Making Apache 2 SSL
View apache-ssl01.sh
#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
View gist:dd25a654f9a1f10a343d
<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 Aug 29, 2015
looking to create a scene graph for three.js and jquery
View scene1.json
{
"scene":{
"renderer":{
"id":"main-renderer",
"type":"WebGLRenderer",
"alpha":true
},
"cameras":[
{
"id":"camera1",
@claytantor
claytantor / gldev.jquery.js
Created Jul 20, 2014
simple threejs plugin for jquery.
View gldev.jquery.js
// 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 Aug 6, 2014
single page simulation
View gldev4.html
<!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() {
View gist:e789334a76d48c2da504
curl -H "Content-Type: application/json" -d '{"username":"xyz","password":"xyz"}' http://localhost:3000/api/login
@claytantor
claytantor / gist:dfc58203690de7ebbec2
Last active Aug 29, 2015
Reset your postgres user password
View gist:dfc58203690de7ebbec2
[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