Skip to content

Instantly share code, notes, and snippets.

View catb0t's full-sized avatar
💭
hmm

Cat Stevens catb0t

💭
hmm
View GitHub Profile
@catb0t
catb0t / wh.c
Created February 5, 2017 13:10
winhak
#include <unistd.h>
#include <stdbool.h>
/*
if path to windows installation is provided then only use that
if a path to scan is provided, test all the subfolders for windows installations
if a path selected as a windows installation is determined to have the patch applied,
*/
#pragma config(Motor, port1, , tmotorVex393_HBridge, openLoop)
#pragma config(Motor, port2, m_clawL, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port3, , tmotorVex393_MC29, openLoop)
#pragma config(Motor, port4, m_armL, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port5, m_drvR, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port6, m_drvL, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port7, m_armR, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port8, , tmotorVex393_MC29, openLoop)
#pragma config(Motor, port9, m_clawR, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port10, , tmotorVex393_HBridge, openLoop)
#pragma config(Motor, port1, , tmotorVex393_HBridge, openLoop)
#pragma config(Motor, port2, m_clawL, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port3, , tmotorVex393_MC29, openLoop)
#pragma config(Motor, port4, m_armL, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port5, m_drvR, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port6, m_drvL, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port7, m_armR, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port8, , tmotorVex393_MC29, openLoop)
#pragma config(Motor, port9, m_clawR, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port10, , tmotorVex393_HBridge, openLoop)
#pragma config(Motor, port1, m_clawL, tmotorVex393_HBridge, openLoop)
#pragma config(Motor, port2, m_drvL, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port3, , tmotorVex393_MC29, openLoop)
#pragma config(Motor, port4, , tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port5, m_armL, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port6, m_armR, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port7, , tmotorVex393_MC29, openLoop)
#pragma config(Motor, port8, , tmotorVex393_MC29, openLoop)
#pragma config(Motor, port9, m_drvR, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port10, m_clawR, tmotorVex393_HBridge, openLoop)
@catb0t
catb0t / carloan.java
Created September 21, 2016 11:40
carloan
double monthlyRate = interestRate / 12f;
double finalPrice = (
carPrice * (
monthlyRate * (
Math.pow( (1f + monthlyRate), loanLength)
) / (
Math.pow( (1f + monthlyRate), loanLength) - 1f))); //Car loan forumla.
finalPrice = Math.floor(finalPrice); //Flooring to make it look nice.
@catb0t
catb0t / inconsist
Created September 12, 2016 14:05
inconsist
canonical-data.json needs standardisation
Hello,
I maintain the Factor track,
and I'd like to automate generation of unit tests
for exercises in my language, and looking at
`exercises/leap/canonical-data.json` it would seem
to be quite simple. However, many of the
`canonical-data.json`s don't have a standard set
@catb0t
catb0t / insults.h
Created June 15, 2016 17:58
Iterations, etc practice in C
const char* insults[] = {
// Homebrew insults (curtesy [sic] of Nick James)
"I used to want you dead... but now I just want you gone...",
"Do you want to join the Skyrim Guard? Okay... Have you ever taken an arrow to the knee? No? Go away.",
// Misc insults hand-picked from Linux culture
"Oh... er, no, please... you really shouldn't do that...",
"// Just trying to create an array of integers for reference " \
"because I keep forgetting how integers look like",
! Copyright (C) 2016 Your name.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays assocs byte-arrays calendar combinators
continuations formatting hashtables html.parser
html.parser.analyzer http.client io io.directories
io.encodings.binary io.files io.pathnames kernel locals make
math math.parser multiline namespaces peg.javascript
peg.javascript.ast regexp sequences splitting strings summary
threads ;
IN: monstercat
[ <process>
"cmdexe" >>command
f >>stderr
utf8 <process-reader> ] [ ] recover
@catb0t
catb0t / serve.js
Created May 30, 2016 15:02
super simple socket server
var http = require('http');
var url = require('url');
var fs = require('fs');
var path = require('path');
var port = (process.argv[2] || 1337);
var baseDir = __dirname;
(http.createServer(function(request,response) {
return (function() {
try {
var reqUrl = url.parse(request.url);