This file contains 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
{-# LANGUAGE OverloadedStrings #-} | |
import Prelude hiding (Word) | |
import Data.Maybe | |
data Stack a = Stack [a] deriving | |
(Show) | |
empty :: Stack a | |
empty = Stack [] |
This file contains 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
sudo npm install -g appium-doctor | |
appium-doctor # find out what is missing, like JAVA_HOME=/usr/lib/jvm/java-7-openjdk | |
# alternative (via git) | |
git clone [email protected]:appium/appium.git | |
cd appium | |
npm install | |
cd - | |
# otherwise |
This file contains 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
sudo dnf install @development-tools @c-development autoconf213 gtk3-devel GConf2-devel dbus-glib-devel yasm-devel alsa-lib-devel pulseaudio-libs-devel |
This file contains 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
function syntaxHighlight(json) { | |
json = json.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>'); | |
return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, function (match) { | |
var cls = 'number'; | |
if (/^"/.test(match)) { | |
if (/:$/.test(match)) { | |
cls = 'key'; | |
} else { | |
cls = 'string'; | |
} |
This file contains 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
#include <Wire.h> | |
#include <Adafruit_PWMServoDriver.h> | |
// called this way, it uses the default address 0x40 | |
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver(); | |
// you can also call it with a different address you want | |
//Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver(0x41); | |
#define SERVOMIN 200 // this is the 'minimum' pulse length count (out of 4096) | |
#define SERVOMAX 500 // this is the 'maximum' pulse length count (out of 4096) |
This file contains 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
class RandomContext(object): | |
""" Use to have a specific seed inside of a context and then restore the seed when jumping back out | |
NOTE random seed is still global | |
Usage: | |
import random; random.seed() | |
print(random.uniform(0, 1)) | |
with RandomContext(random, 1337) as r: | |
print(r.uniform(0, 1)) |
This file contains 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
docker run -it $(docker images -q | head -n 1) bash |
This file contains 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
from __future__ import division, print_function | |
from itertools import * | |
from functools import * | |
from operator import * | |
from collections import * | |
from joblib import Parallel, delayed | |
import numpy as np |
This file contains 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
from selenium.webdriver import Firefox | |
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary | |
import sys | |
driver = Firefox(firefox_binary=FirefoxBinary(log_file=sys.stdout)) |
This file contains 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
Prelude> data TwoD f g a = TwoD (f (g a)) deriving Show | |
Prelude> TwoD [Just 3] | |
TwoD [Just 3] | |
Prelude> :t TwoD [Just 3] | |
TwoD [Just 1] :: Num a => TwoD [] Maybe a | |
Prelude> :{ | |
Prelude| instance (Functor f, Functor g) => Functor (TwoD f g) where | |
Prelude| fmap o = fmap (fmap o) | |
Prelude| :} |