Skip to content

Instantly share code, notes, and snippets.

View stravant's full-sized avatar

Mark Langen stravant

  • Roblox
  • Bay Area
View GitHub Profile
@stravant
stravant / grab_tracked.lua
Created November 17, 2014 21:27
Grab posts from the Roblox forums from your tracked threads
#!/usr/bin/lua
local tracked_url = "http://www.roblox.com/Forum/User/MyForums.aspx"
local base_url = "http://www.roblox.com/Forum/ShowPost.aspx?PostID="
local cookie = "(Paste your .ROBLOSECURITY cookie which you can find in your browser cookies, don't share this script with it still pasted in there obviously)"
function cmd(txt)
os.execute(txt)
end
ZERO = 0
ONE = 1
EITHER = 2
nvars = 4
varnames = ['a', 'b', 'c', 'd']
func = lambda a,b,c,d: (a and b) or (c and d)
import random
graph = [
(0,0),
(20,0),
(20,20),
(0,20),
]
#add some random points
@stravant
stravant / parse.py
Last active December 12, 2015 12:19
Python Parser
import builtins
###############################################################################
#From SO: http://stackoverflow.com/questions/1988804/
class Memoize:
def __init__(self, f):
self.f = f
@stravant
stravant / logic.cpp
Created November 27, 2012 17:47
Arduino Solitaire Logic
struct Card {
CardColor Color;
CardSuit Suit;
CardValue Value;
//
bool FaceUp;
//
Card* Next;
Card* Prev;
@stravant
stravant / logic.cpp
Created November 27, 2012 17:47
Arduino Solitaire Logic
struct Card {
CardColor Color;
CardSuit Suit;
CardValue Value;
//
bool FaceUp;
//
Card* Next;
Card* Prev;
@stravant
stravant / restaurant.h
Created November 6, 2012 03:56
Packed Restaurant
class PackedRestaurantRecord {
public:
//MAD BIT TWIDDLING ~~~ AVERT YOUR GAZE!
uint8_t getBlockNum() {
return (C & 0x0F) | (D & 0xF0);
}
void setBlockNum(uint8_t n) {
C = (C & 0xF0) | (n & 0x0F);
D = (D & 0x0F) | (n & 0xF0);
}
@stravant
stravant / draw.h
Created November 5, 2012 00:03
Large map draw function
// x, y, w, h specify what region of the screen to update.
// mZoom specifies the zoom level to draw the map at (1 = 1:1, 2 = only every other pixel is shown, etc)
// mOriginX/Y specifies what position on the map is currently at the screen's top right corner.
void draw(int32_t x, int32_t y, int32_t w, int32_t h) {
tft.setAddrWindow(x, y, x+w-1, y+h-1);
//
x *= mZoom;
y *= mZoom;
x += mOriginX;
@stravant
stravant / mapping.cpp
Created October 30, 2012 16:46
Mapping
/* Simple Image Drawing
*
* Draws an image to the screen. The image is stored in "parrot.lcd" on
* the SD card. The image file contains only raw pixel byte-pairs.
*/
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library
#include <SPI.h>
#include <SD.h>
@stravant
stravant / terrain.lua
Created October 22, 2012 05:18
Roblox Terrain Generator
local Terrain = game.Workspace.Terrain
--==========================================================================================================--
-- Persistent noise generation code ==--
--==========================================================================================================--
--
-- Generating perlin noise is the most expensive part of the terrain generation. It is also however, totally
-- predictable, so we can pre-generate most of the perlin noise that we will need before the main terrain