Skip to content

Instantly share code, notes, and snippets.

@linusthe3rd
linusthe3rd / circles.cpp
Created January 30, 2011 18:54
The two methods used to create circles in opengl
/*
* Function that handles the drawing of a circle using the triangle fan
* method. This will create a filled circle.
*
* Params:
* x (GLFloat) - the x position of the center point of the circle
* y (GLFloat) - the y position of the center point of the circle
* radius (GLFloat) - the radius that the painted circle will have
*/
void drawFilledCircle(GLfloat x, GLfloat y, GLfloat radius){
var attempts = 1;
function createWebSocket () {
var connection = new WebSocket();
connection.onopen = function () {
// reset the tries back to 1 since we have a new connection opened.
attempts = 1;
// ...Your app's logic...
@linusthe3rd
linusthe3rd / websocketPolling.js
Created March 2, 2014 17:40
WebSocket Reconnection with Basic Polling
// Polling example to reconnect a WebSocket connection. I recommend NOT using this in your app.
function createWebSocket () {
var connection = new WebSocket();
connection.onclose = function () {
setTimeout(function () {
// Connection has closed so try to reconnect every 10 seconds.
createWebSocket();
}, 10*1000);
from boto.dynamodb2 import connect_to_region
from boto.provider import Provider
aws_settings_provider = Provider('aws')
def create_connection():
aws_region = # get the AWS region of the EC2 instance
# connect_to_region passes along the named arguments to the DynamoDBConnection class that gets created
return connect_to_region(

Keybase proof

I hereby claim:

  • I am strife25 on github.
  • I am jryding (https://keybase.io/jryding) on keybase.
  • I have a public key whose fingerprint is 0F0E 61AC AD6F BB41 6060 D052 953A 1B0C BB0C 5BB7

To claim this, I am signing this object:

@linusthe3rd
linusthe3rd / aws_creds_export.sh
Last active September 1, 2016 16:57
Export AWS Credentials into Environment Vars
# If you use multiple AWS environments, change this to your profile name to export a different set of credentials
export AWS_PROFILE=default
export AWS_ACCESS_KEY_ID=$(aws configure get aws_access_key_id)
export AWS_SECRET_ACCESS_KEY=$(aws configure get aws_secret_access_key)
$(document).ready(function() {
var embedGist = function () {
$('a[href^="https://gist.github.com"]').each(function(i) {
if (writeCapture) {
var wrapper = $("<div></div>");
wrapper.insertAfter(this);
writeCapture.html(wrapper[0], '<script src="'+$(this).attr("href")+'.js"></script>');
$(this).remove();
} else {
// ...other instantiation logic...
var userID = getIDFromPageURI();
var user = null;
var loadUser = function (id) {
// GET the latest state of the user from the backend
$.get("/api/user" + id)
.done(function (response) {
if (!user) {
This file has been truncated, but you can view the full file.
{
"/src/js/bindingHandlers/include.js": {
"lineData": [
null,
4,
null,
null,
null,
4,
null,
@linusthe3rd
linusthe3rd / gist:4727217
Created February 7, 2013 00:21
in-place String reversal
void strrev(char *p) {
char *q = p;
while(q && *q) ++q; //get last char of the string
for(--q; p < q; ++p, --q) {
*p = *p ^ *q, //xor p
*q = *p ^ *q, // xor np w/ q to store p's value in q
*p = *p ^ *q; //xor np w/ nq to get q's original value in p
}
}