Skip to content

Instantly share code, notes, and snippets.

View pscollins's full-sized avatar

Patrick Collins pscollins

View GitHub Profile
@pscollins
pscollins / foo.md
Last active February 19, 2016 07:56
kira does assembly

The actual disassembly of the two is below for the sake of it existing somewhere, but basically the homequeue version looks like:

START:
result = deq(thing)
if result == 0:
    goto FAIL
packets_processed++
getFingerprint()

FAIL:

#include <stdio.h>
#ifdef BE_QUIET
#define P_TYPE(x, type)
#else
#define P_TYPE(x, type) printf("%s @ (%s:%d): %s " type "\n", __func__, __FILE__, __LINE__, #x, x)
#endif
#define PI(x) P_TYPE(x, "%i")
#define PS(x) P_TYPE(x, "%s")
should_start = (not partial_start) or (dt != gnip_start)
should_end = (not partial_end) or (dt != gnip_end)
should_something = partial_start and partial_end
if should_something and should_start and should_end:
acc[(str(d))] = str(v)
should_start = (not partial_start) or (dt != gnip_start)
should_end = (not partial_end) or (dt != gnip_end)
if should_start and should_end:
acc[str(d)] = str(v)
➜ p3 git:(master) ✗ ./chidb 1table-1index-1pageeach.cdb
chidb> explain select code from numbers where altcode > 5;
addr opcode p1 p2 p3 p4
---------- ---------- ---------- ---------- ---------- ----------
0 Integer 2 0 0
1 OpenRead 0 0 3
2 Integer 5 1 0
3 Integer 3 2 0
4 OpenRead 1 2 2
DROP VIEW OneHop;
DROP VIEW TwoHop;
DROP VIEW ThreeHop;
CREATE VIEW OneHop AS
SELECT dst as airportCode
FROM Flights
WHERE src="PDX";
SELECT name FROM OneHop NATURAL JOIN Airports;
/usr/lib/jvm/java-8-oracle/bin/java -Xms512M -Xmx1024M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M -Didea.launcher.port=7538 -Didea.launcher.bin.path=/home/patrick/hacking/java/intellij-idea/bin -Dfile.encoding=UTF-8 -classpath /home/patrick/.IdeaIC14/config/plugins/Scala/launcher/sbt-launch.jar:/home/patrick/hacking/java/intellij-idea/lib/idea_rt.jar com.intellij.rt.execution.application.AppMain xsbt.boot.Boot android:package
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256M; support was removed in 8.0
[info] Loading project definition from /home/patrick/hacking/mobile/hello-scaloid-sbt/project
[info] Set current project to hello-scaloid-sbt (in build file:/home/patrick/hacking/mobile/hello-scaloid-sbt/)
[info] Processing resources
ProGuard, version 5.1
ProGuard is released under the GNU General Public License. You therefore
must ensure that programs that link to it (android, ...)
carry the GNU General Public License as well. Alternatively, you can
apply for an excepti
class Greeting extends SActivity {
val LOCATION_DEFAULT = "Location not available."
override def onCreate(savedInstanceState: Bundle) {
super.onCreate(savedInstanceState)
var latText: STextView = null
var lonText: STextView = null
contentView = new SVerticalLayout {
STextView(s"${R.string.prompt.r2String}! ${getIntent.getStringExtra("name")}") textSize 75.dip
latText = STextView(LOCATION_DEFAULT) textSize 50.dip
lonText = STextView(LOCATION_DEFAULT) textSize 50.dip
{-# LANGUAGE ScopedTypeVariables #-}
module BST where
import Test.QuickCheck
import Control.Monad
import Control.Applicative
data BST a = Empty
| Node {value :: a, left :: BST a, right :: BST a}
import Control.Monad.ST
import Control.Monad
import Data.Array
import Data.Array.ST
import Data.List (elemIndex)
import Data.Maybe (fromMaybe)
newSTArray :: (Ix i) => (i,i) -> e -> ST s (STArray s i e)
newSTArray = newArray