Skip to content

Instantly share code, notes, and snippets.

View CodeZombie's full-sized avatar
🌵

Jeremy Clark CodeZombie

🌵
View GitHub Profile
<!-- this good thing was written by Cazum (zombiearmy.net) in April, 2015. released under the WTFPL.-->
<html>
<head>
<meta name="viewport" content="initial-scale=1">
<style>
* {
box-sizing: border-box;
}
.grid {
@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"
@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 / 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 / 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 / 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 / rainbowirc.py
Last active January 24, 2016 01:31
rainbow text for Jenni irc bots .py command
.py global t; t='YOUR TEXT HERE'; print ''.join('' + str(divmod(n,14)[1]+1) + t[n] for n in range(0,len(t)))
@CodeZombie
CodeZombie / montecarloPi.go
Last active March 30, 2016 00:33
Pi Estimator using Montecarlo method in Go
/*
/ ########
/ # ## #
/ # # # #
/ ## ##
/ # #
/ # #
/ ## ##
/ # # # #
/ # ## #
@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 / generateCellsFromDNA.lua
Created April 7, 2016 06:24
Recursive function for generating unique cell patterns given a base4 string of "dna"
--call with self.cells = self:generateCellsFromDNA(DNAString, {{x=0, y=0}})
function Creature:generateCellsFromDNA(DNAStrand, cellPool)
function cellPoolContains(x_, y_, cp_) --function that checks if a position exists in a table of positions (cellPool)
for _, val in pairs(cp_) do
if val.x == x_ and val.y == y_ then
return true
end
end
return false