Skip to content

Instantly share code, notes, and snippets.

Avatar

Thomas Manning atomictom

  • Google
  • Dublin, Ireland
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am atomictom on github.
  • I am atomictom (https://keybase.io/atomictom) on keybase.
  • I have a public key whose fingerprint is ABF1 8947 B280 6045 EE7F 3255 3F61 3807 B9F9 BC1B

To claim this, I am signing this object:

View gist.py
import time
import math
import pymavlink
import droneapi.lib
from pymavlink import mavutil
from droneapi.lib import VehicleMode
DEBUG = True
GPS_3D_FIX = 3
View gist.py
import time
import math
import pymavlink
import droneapi.lib
from pymavlink import mavutil
from droneapi.lib import VehicleMode
DEBUG = True
GPS_3D_FIX = 3
View simple-sentence-parse.py
#!/usr/bin/python
import os
import sys
class Node(object):
def __init__(self):
self.is_word = False
self.children = {}
View sentence-parse.py
#!/usr/bin/python
import os
import sys
class Node(object):
def __init__(self):
self.is_word = False
self.children = {}
View interpreter.hs
import Text.Parsec
import Text.ParserCombinators.Parsec (GenParser)
import Control.Applicative ((<$>), (*>), (<*>), (<*))
type UnaryOp = Integer -> Integer
type BinOp = Integer -> Integer -> Integer
data Expr = Binary BinOp Expr Expr
| Unary UnaryOp Expr
| Num Integer
View Github Markdown Test
<aside class="notice">
You must replace `meowmeowmeow` with your personal API key.
</aside>
View bayes.hs
import System.Environment
import Control.Applicative
import Data.Maybe
import Data.List
import Data.List.Split
import Data.Map.Strict ((!), Map, fromList)
type Class = String
type Mean = Double
type StdDevSquared = Double
View projects.html
{% highlight c linenos %}
void bitset(unsigned char * array, int index){
int newval;
int oldval;
int bitset_index = index / BITS_PER_INDEX;
int bit_index = index % BITS_PER_INDEX;
do{
oldval = array[bitset_index];
newval = oldval | (1 << (bit_index));
}while(!__sync_bool_compare_and_swap(&array[bitset_index], oldval, newval));
View parallel_primes.c
/* Because bitset comprises 3 operations:
* 1. Read array[bitset_index] into 'temp'
* 2. Set bit (bit_index) on 'temp'
* 3. Write 'temp' into array[bitset_index]
* A thread running bitset can be preempted before it can write 'temp', during
* which time another thread has written 'array[bitset_index]', and 'temp' does
* not include the changes made by that thread. Thus, the preempted thread
* overwrites the changes made by the other thread when it executes step 3.
*
* To avoid this, I use the GCC extension '__sync_bool_compare_and_swap' which