Skip to content

Instantly share code, notes, and snippets.

View slyphon's full-sized avatar

Jonathan Simms slyphon

View GitHub Profile
@slyphon
slyphon / pac-std.md
Last active August 15, 2017 00:54
pacific standard glitch finale
  • Car glitch
    • Glitcher steals a car, goes to their garage, walk in, walk out, parks that car outside bank
    • Everyone else does not hit checkpoint, waits for glitcher to arrive
  • Everyone hits checkpoint, enters bank
  • Inside bank
    • Kill everyone (causes SWAT van to spawn)
    • HACKER grabs the money
    • Crowd Control watches back stairs, kills guards that come out of door
  • Regroup at front door
  • HACKER RUNS TO THE VAULT: DOES NOT GO OUTSIDE
@slyphon
slyphon / oi.js
Created April 24, 2016 23:50 — forked from PaulCapestany/oi.js
Dan Kaminsky's DefCon RNG challenge
// TLDR: Oi, Barnes. We'll miss ya. Here's a grimy RNG in your honor.
// node oi.js or paste the below into your favorite browser's JS console.
// DEFCON CHALLENGE: Break this!
function millis() { return Date.now(); }
function flip_coin() { n=0; then = millis()+1; while(millis()<=then) { n=!n; } return n; }
function get_fair_bit() { while(1) { a=flip_coin(); if(a!=flip_coin()) { return(a); } } }
function get_random_byte(){ n=0; bits=8; while(bits--){ n<<=1; n|=get_fair_bit(); } return n; }
report_console = function() { while(1) { console.log(get_random_byte()); }}
@slyphon
slyphon / cas.scala
Last active November 20, 2015 16:55
possible change to Memcache api
def cas(key: String, flags: Int, expiry: Time, value: Buf, casUnique: Buf): Future[JBoolean] = {
cas2(key, flags, expiry, value, casUnique).flatMap {
case Some(b) if b => JavaTrue
case Some(b) => JavaFalse
case None => JavaFalse
}
}
private[this] val SomeJTrue: Future[Option[JBoolean]] = Future.value(Some(true))
private[this] val SomeJFalse: Future[Option[JBoolean]] = Future.value(Some(false))
#include<iostream>
using namespace std;
int main()
{
bool prime = false;
int n;
int i = 2;
#include <iostream>
using namespace std;
int main()
{
float sum = 0;
int i;
for (i = 0; i < 5; i++)

Keybase proof

I hereby claim:

  • I am slyphon on github.
  • I am slyphon (https://keybase.io/slyphon) on keybase.
  • I have a public key whose fingerprint is 540D 0F6B BB84 A4CA A39F 2FA5 EA31 6248 4543 75AA

To claim this, I am signing this object:

@slyphon
slyphon / whatdothetypessay.scala
Last active December 30, 2015 23:59
I'm way too happy that I was able to get this to work (specifically OMGThatsUseful.soAmaze)
sealed abstract class BaseClass {
def name: String
def someData: Option[Int]
}
trait NamedThing extends BaseClass {
def name: String
}
trait WhatDoTheTypesSay[This <: NamedThing] {
/etc
/usr/lib
/usr/bin
char
scala
java
cache
solaris
linux (strong no hire if gnu is mentioned)
gif
@slyphon
slyphon / KeyValueResult.scala
Created July 11, 2013 03:04
A super useful class for dealing with Futures and collections and dealing with results from backend data stores. Shout out to @caniszczyk for giving the OK to share this with the community. Authors: Jeremy Cloud, Kevin Oliver, Glen Sanford, and Evan Meagher
/**
* Copyright 2013 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@slyphon
slyphon / clipboard.scala
Created May 28, 2013 03:04
This, more than anything, has improved my productivity an embarassing amount (w/ the scala repl)
import java.io.{PrintWriter, OutputStreamWriter, BufferedOutputStream}
// copy given string to the mac clipboard by launching pbcopy in a subprocess
object Clipboard {
def pbcopy(string: String) {
val pb = new ProcessBuilder("/usr/bin/pbcopy")
val p = pb.start()
val stdin = new PrintWriter(new OutputStreamWriter(new BufferedOutputStream(p.getOutputStream)))
stdin.print(string)
stdin.close()