This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(req, res, next) => { | |
let parsing = false; | |
const RE_BOUNDARY = /^multipart\/.+?(?:; boundary=(?:(?:"(.+)")|(?:([^\s]+))))$/i; | |
if (req.headers['content-type']) { | |
const regexResult = RE_BOUNDARY.exec(req.headers['content-type']); | |
if (regexResult) { | |
parsing = true; | |
const boundary = regexResult[1] || regexResult[2]; | |
const d = new Dicer({ boundary }); | |
d.on('part', p => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time, threading, socket, SocketServer, BaseHTTPServer, SimpleHTTPServer | |
class Handler(SimpleHTTPServer.SimpleHTTPRequestHandler): | |
def do_GET(self): | |
header = 'X-Forwarded-For' | |
ip_address = self.headers[header] | |
if header is not None: | |
reversed_dns = socket.gethostbyaddr(ip_address) | |
print 'Serving for %s (%s)' % (ip_address, reversed_dns[0]) | |
return SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import styled, { keyframes } from "styled-components"; | |
// PIXELS per SECOND | |
const RATE = 100; | |
class DVDBox extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
typedef uint64_t CGSSpace; | |
typedef uint64_t CGSManagedDisplay; | |
typedef int CGSConnection; | |
typedef enum _CGSSpaceSelector { | |
kCGSSpaceCurrent = 5, | |
kCGSSpaceOther = 6, | |
kCGSSpaceAll = 7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3.3 | |
import nlzss.lzss3 | |
import pygame | |
import struct | |
import sys | |
from optparse import OptionParser | |
DEBUG_MODE = False | |
def debug(*args, **kwargs): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Run this with: | |
# find /Applications/Xcode.app/ -type f -perm -100 -exec ./extract.sh '{}' \; | |
# Afterwords run: (to remove all empty directories) | |
# find . -d -type d -empty -exec rmdir {} \; | |
APP=$1 | |
BASE_DIR=`pwd` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python -u | |
import math | |
import time | |
x_start = 400 | |
y_start = 500 | |
# 100 = 1 full rotation | |
TICKS = 500 | |
# Measured in pixels. | |
SIZE = 100 |