Skip to content

Instantly share code, notes, and snippets.

View CodeZombie's full-sized avatar
🌵

Jeremy Clark CodeZombie

🌵
View GitHub Profile
@CodeZombie
CodeZombie / gpacaa.lua
Created April 7, 2016 01:49
A function that returns equally spaced points along a circle in Lua
function getPointsAlongCircleAsArray(radius, originX, originY, steps)
points = {}
for i=1, steps do
points[i] = {}
points[i]['x'] = originX + radius * math.cos(((i-1)/steps) * (2*math.pi))
points[i]['y'] = originY + radius * math.sin(((i-1)/steps) * (2*math.pi))
end
return points
end
@CodeZombie
CodeZombie / montecarloPi.go
Last active March 30, 2016 00:33
Pi Estimator using Montecarlo method in Go
/*
/ ########
/ # ## #
/ # # # #
/ ## ##
/ # #
/ # #
/ ## ##
/ # # # #
/ # ## #
@CodeZombie
CodeZombie / animationSystem.lua
Last active February 4, 2017 20:06
very rough sketch of an sprite animation system written in lua
Animator = {
animations = {4, 6, 12}--how many frames per animation. This should be a table holding all the information about each animation
}
function Animator.animate(aState_)
if aState_.index ~= 0 then --if theres an animation to run
aState_.frame = aState_.frame + 1
if aState_.frame > Animator.animations[aState_.index] then
aState_.frame = 0
end
end
@CodeZombie
CodeZombie / expand.js
Last active August 17, 2025 12:40
Expand All Images in 4chan Thread Greasemonkey Extension
// ==UserScript==
// @name Expand All Images
// @namespace zombiearmy.expandimage
// @description Expand all images in a 4chan thread
// @match *://boards.4chan.org/*
// @match *://boards.4channel.org/*
// @version 2
// @grant none
// ==/UserScript==
@CodeZombie
CodeZombie / canvasMouse.js
Created January 24, 2016 07:19
A small script that gets the relative mouse position inside a Canvas element.
function mousePosition(e_) {
//accepts a mouseEvent
var canvas = document.getElementById("myCanvas");
var canvas_bound_rect = canvas.getBoundingClientRect();
mousex = Math.round(((e_.clientX - canvas_bound_rect.left)/(canvas_bound_rect.right - canvas_bound_rect.left)) * canvas.width);
mousey = Math.round(((e_.clientY - canvas_bound_rect.top)/(canvas_bound_rect.bottom - canvas_bound_rect.top)) * canvas.height);
return {x : mousex, y : mousey}
}
@CodeZombie
CodeZombie / plexpowered_serverdaemon.rb
Created January 5, 2016 02:19
ruby script that allows a home theater pc to shut down if network is inactive, as well as handling plexmediaserver
#Plexhometheater closes itself after 30 minutes of inactivty
#This script checks to see if plexhometheater is off, and if it is,
#checks for any major network traffic (to indicate movie stream, or file xfer)
#if no network activity is detected, the computer shuts down.
#if network activity IS detected, plexhometheater is started again
def plexIsRunning()
command = `ps -ef|grep -v grep|grep /opt/plexhometheater/bin/plexhometheater`
if command == "" then
return false
end
@CodeZombie
CodeZombie / sevenSeg.c
Created August 14, 2015 23:43
AlphaNumeric seven segment arduino sketch with Bitshifting/bitmasking
static unsigned char alphanum[37] = {0xEE, 0x3E, 0x9C, 0x7A, 0x9E, 0x8E, 0xBC, 0x6E, 0x0C, 0x78, 0xAE, 0x1C, 0xA8, 0xEC, 0xFC, 0xCE, 0xE6, 0xCC, 0xB6, 0x1E, 0x7C, 0x74, 0x54, 0x6E, 0x76, 0xD2, 0xFC, 0x60, 0xDA, 0xF2, 0x66, 0xB6, 0xBE, 0xE0, 0xFE, 0xF6, 0x00};
int pin_offset = 2; //the pin your 7seg starts at.
//used for cycling through characters
int iterator = 200; //just for demonstration purposes.
void printCharacter(char c_) {
//if the character is a lowercase alpha, convert it to an uppercase.
if(c_ >= 97 && c_ <= 122) {
c_ -= 32;//lowercase letters appear 32 places higher in the ascii table
@CodeZombie
CodeZombie / 4chan_image_dumper.c
Created August 10, 2015 23:41
4chan image dumper. Requires libcurl, stat and some standard C junk.
#include <stdio.h>
#include <sys/stat.h>
#include <stdlib.h>
#include "curl/curl.h"
#include <string.h>
/* Use libcurl-openssl-dev
* in geany, only use f9 to compile the project and f5 to run it. the buttons at the top dont do the same thing.
* Next, -l flags should be added to the end of the 'build' command. Not compile
* yes, I'm new to C :)
@CodeZombie
CodeZombie / hella_ie
Created May 6, 2015 20:21
Gracefuly degrading hella framework
/* Will display mobile version on browsers that don't support media queries (<= IE8, feature phones, etc)*/
/* This may be possible to reduce further, as there are three .column instances, and there may be redundant properties */
.grid {
width:100%;
padding: 0 32px;
max-width:960px;
margin: 0 auto;
box-sizing: border-box;
}
.row:after{
@CodeZombie
CodeZombie / gist:c186175f174daeed21a6
Created May 5, 2015 01:03
Compiling mongoose win32
follow this guide for statically linked library compilation:
http://www.adp-gmbh.ch/cpp/gcc/create_lib.html
on the final step where you compile main.c, add "-lws2_32" to the end of the line.
so, "gcc -static main.c -L. -lmongoose -o output -lws2_32"