Skip to content

Instantly share code, notes, and snippets.

View rsheldiii's full-sized avatar

Bob rsheldiii

View GitHub Profile
@rsheldiii
rsheldiii / mandelbrot.py
Created June 2, 2012 22:16
pygame mandelbrot
from __future__ import division
import sys, pygame, time
import numpy as N
import pygame.surfarray as surfarray
pygame.init()
size = width, height = 1024,768
xlength,xoffset = 3.5, -2.5
@rsheldiii
rsheldiii / chess.py
Created June 26, 2012 04:07
chess program for python
"""CONVENTIONS:
positions are done row-column from the bottom left and are both numbers. This corresponds to the alpha-number system in traditional chess while being computationally useful. they are specified as tuples
"""
import itertools
WHITE = "white"
BLACK = "black"
@rsheldiii
rsheldiii / adfgvx.py
Created June 26, 2012 19:23
adfgvx encryptor/decryptor
def normalize(plainString,scrambledAlphabet):
plainString = plainString.upper().replace("J","I")
for letter in plainString:
if letter not in scrambledAlphabet:
plainString = plainString.replace(letter,'')
#print(plainString)
return plainString
@rsheldiii
rsheldiii / adfgvx.py
Created June 27, 2012 00:27
adfgvx brute force decryptor. decryption based on wordlist and caesar shift of the alphabet, using the fact that space will be the most prevalent letter
def encodingDict(scrambledAlphabet):
adfgvxIndex = ['A','D','F','G','V','X']
encodeDict = {}
for i in range(0,6):
for j in range(0,6):
encodeDict[scrambledAlphabet[i*6+j]] = adfgvxIndex[i]+adfgvxIndex[j]
return encodeDict
def DecryptOnSpace(encryptedString,codeWord):
@rsheldiii
rsheldiii / rasterizer.py
Created August 24, 2012 18:58
walkaround rasterizer. Supports raster directions to image and most image formats (L,P,RGB,RGBA) to raster directions
import Image,sys,struct,time,os
BLACK,WHITE = 0,1
def rasterToImg(name,width,height,directions):
name,ext = os.path.splitext(name)
arr = [WHITE for j in range(0,width*height)]
x,y = 0,0
size = width,height
dic = {"N":(0,-1), "S" : (0,1) , "E" : (1,0), "W" : (-1,0)}
@rsheldiii
rsheldiii / twitchitup.sh
Created September 20, 2016 03:33
Watch twitch screens on a framebuffer on a raspberry pi with mplayer2
#!/usr/bin/bash
# after running whichever modprobe fbtft_device command
sudo SDL_VIDEODRIVER=fbcon SDL_FBDEV=/dev/fb1 livestreamer twitch.tv/$1 mobile --yes-run-as-root -v -p 'mplayer --nosound --noass --no-autosub --no-lirc --no-mouseinput --no-mouseinput -vo sdl'
@rsheldiii
rsheldiii / sandwich.rb
Created October 6, 2016 19:00
automatic compliment sandwich generator
#!/usr/bin/env ruby
top = ['this looks awesome! ', 'this is excellent!', 'My eyes, they can\'t handle the glory!', 'but soft! what code through yonder window breaks?', 'Stellar!', 'Radical dude!', 'Perfect! I love it!']
bottom = ['You got it, dude!', 'keep rockin, pal!', 'But that\'s just a small suggestion.', 'But everything else is wonderful!', 'But I love how everything else looks!']
puts [top.sample, ARGV.join(' '), bottom.sample].join(' ')
@rsheldiii
rsheldiii / ConstantsContext.jsx
Created January 14, 2019 17:05
React Higher Order Component to manage constants on the context
import React, { Component } from 'react';
import PropTypes from 'prop-types';
const ConstantContext = React.createContext({});
const ConstantConsumer = ConstantContext.Consumer;
export const ConstantProvider = ConstantContext.Provider;
export const ConstantConnect = (Wrappee) => {
@rsheldiii
rsheldiii / keymap.c
Last active January 25, 2019 17:02
Gherkin keymap.c with combos
/* Copyright 2017 Brian Fong
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@rsheldiii
rsheldiii / keymap.c
Created February 22, 2019 21:41
Gergo keymap
/* Good on you for modifying your layout! if you don't have
* time to read the QMK docs, a list of keycodes can be found at
*
* https://github.com/qmk/qmk_firmware/blob/master/docs/keycodes.md
*
* There's also a template for adding new layers at the bottom of this file!
*/
#include QMK_KEYBOARD_H