Skip to content

Instantly share code, notes, and snippets.

View CodeZombie's full-sized avatar
🌵

Jeremy Clark CodeZombie

🌵
View GitHub Profile
@CodeZombie
CodeZombie / slug
Created April 3, 2015 00:50
Ruby Slug Generator
def createSlug(title)
maxlength = 35
title = title.gsub(' ', '-').gsub(/[^\w-]/, '').gsub(/(-){2,}/, '-').downcase
return title[0, title.length > maxlength ? (title[0, maxlength].rindex('-') or maxlength) : maxlength]
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)))
<!-- 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 / 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 / expand.js
Last active March 3, 2024 02:44
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==