Skip to content

Instantly share code, notes, and snippets.

View a10y's full-sized avatar
🇺🇲
DC

Andrew Duffy a10y

🇺🇲
DC
View GitHub Profile
@a10y
a10y / iOSAccelerometer.java
Created April 23, 2011 03:41
iOSAccelerometerReceiver.java
package com.iaroc.ios;
import java.net.DatagramSocket;
import java.net.DatagramPacket;
/*
* iOSAccelerometerReceiver: Class that handles a UDP connection to an
* iOS device and parses the data for accelerometer data.
*
* @author gerberduffy
@a10y
a10y / find.sh
Created August 5, 2011 06:02
find
## Find move all mp4 movies in a directory to an external drive/folder, than delete all large files
LARGE_FILE_SIZE=500 ##in MB
START_DIR=$HOME
EXTERN_DIR=/Volumes/Extern/movies
find $START_DIR -type f -name "*.mp4" -exec mv {} $EXTERN_DIR ';'
find $START_DIR -type f -size +${LARGE_FILE_SIZE}M -exec rm {} ';'
@a10y
a10y / sum-binary-float-imgs.c
Created July 28, 2012 05:37
Sum of Two Floating Point Binary Images
#include <stdio.h>
#include <stdlib.h>
#define SIZE 128 //If you have an input image that is NxN, SIZE = N.
//Adjust to suit your needs.
int main(int argc, char* argv[]){
FILE* imageA = fopen(argv[1], "rb"); //Input image 1 (filename read from argv[1])
FILE* imageB = fopen(argv[2], "rb"); //Input image 2 (filename read from argv[2])
@a10y
a10y / s3-cubes-testing.php
Created July 28, 2012 05:56
PHP Script that fetches S3 Urls to Binary images from a MySQL DB, does computation and returns URL to resultant S3 file
<html>
<head><title>Cube Testing</title></head>
<body>
<?php
/**
*
Author: Andrew Duffy
test.php: Take the sum of two floating-point images
stored in binary files on S3 whose URLs are to be
@a10y
a10y / fix-permissions.sh
Created July 28, 2012 06:30
Correct Apache2 DocumentRoot file permissions
sudo chown -Rv root /var/www
sudo chgrp -Rv www-data /var/www
@a10y
a10y / gist:4052017
Created November 10, 2012 18:22
OpenGL Fragment Shader
void InitShading(){
//Fragment shader we want to use
GLuint oddRowShaderId = glCreateShader(GL_FRAGMENT_SHADER);
std::cout << "Creating the fragment shader with id " << oddRowShaderId << std::endl;
const GLchar *source =
"void main(){"
" if (mod(gl_FragCoord.y-0.5, 2.0) == 1.0){"
" gl_FragColor = gl_Color;"
@a10y
a10y / odd-row-shader.cpp
Last active May 19, 2016 21:13
OpenGL Odd Row Fragment Shader
#include <iostream>
#include <stdio.h>
//This is nice: http://stackoverflow.com/questions/3907818/opengl-headers-for-os-x-linux
//OS X headers
#ifdef __APPLE__
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#include <GLUT/glut.h>
@a10y
a10y / 21-status-server.py
Created December 18, 2015 06:30
Simple python3 web server to view your mining status
#!/usr/bin/env python3
# Written by Andrew Duffy, December 2015
from http.server import BaseHTTPRequestHandler, HTTPServer
from subprocess import Popen, PIPE
SCRIPT_TEXT = b"""
<script type="text/javascript">
setTimeout(function() { location.reload() }, 5000)
</script>
"""
@a10y
a10y / osx-notify-mention.pl
Created December 21, 2015 18:45
Irssi Script for Desktop Notifications on OS X
#
# Title: osx-notify-mention.pl
# Author: Andrew Duffy <[email protected]>
# Descrption: A no-deps irssi script that sends desktop notifications on OSX
# when a message comes into a channel you've joined that mentions
# your nick.
#
use strict;
use Irssi;
@a10y
a10y / nginx.conf
Last active January 23, 2016 08:55
Nginx + LetsEncrypt Configuration With Proxying to Github Pages
worker_processes 1;
events {
worker_connections 1024;
}
http {
server {
listen 80;
server_name aduffy.org;