Skip to content

Instantly share code, notes, and snippets.

View chrissound's full-sized avatar

Chris Stryczynski chrissound

View GitHub Profile
public void waitTillLoaded() {
try {
Log.d("hmm", "abc");
soundLoadedSemaphore.acquire(counter.i);
Log.d("hmm", "xyz");
} catch (Exception e)
{
}
}
data MyFull a = MyFull deriving (Show, Read)
instance LayoutClass MyFull a where
description MyFull = "My experiment"
pureLayout MyFull rectangle stack = [(a, Rectangle 50 50 200 300)]
import Control.Applicative
import Control.Monad
import System.IO
import Debug.Trace
getMultipleLines :: Int -> IO [String]
getMultipleLines n
| n <= 0 = return []
| otherwise = do
x <- getLine
import Control.Monad
import Control.Monad.Trans
import Control.Applicative
data EitherMaybeT e a = EitherMaybeT {runEitherMaybe :: Either e (Maybe a)}
instance Functor (EitherMaybeT e) where
fmap f = EitherMaybeT . fmap (fmap f) . runEitherMaybe
instance Applicative (EitherMaybeT e) where
Searching for ghc in path.
Found ghc at /usr/bin/ghc
("/usr/bin/ghc",["--numeric-version"])
/usr/bin/ghc is version 8.0.2
looking for tool ghc-pkg near compiler in /usr/bin
found ghc-pkg in /usr/bin/ghc-pkg
("/usr/bin/ghc-pkg",["--version"])
/usr/bin/ghc-pkg is version 8.0.2
("/usr/bin/ghc",["--supported-languages"])
("/usr/bin/ghc",["--info"])
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<style type="text/css">
.ansi2html-content { display: inline; white-space: pre-wrap; word-wrap: break-word; }
.body_foreground { color: #AAAAAA; }
.body_background { background-color: #000000; }
.body_foreground > .bold,.bold > .body_foreground, body.body_foreground > pre > .bold { color: #FFFFFF; font-weight: normal; }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<style type="text/css">
.ansi2html-content { display: inline; white-space: pre-wrap; word-wrap: break-word; }
.body_foreground { color: #AAAAAA; }
.body_background { background-color: #000000; }
.body_foreground > .bold,.bold > .body_foreground, body.body_foreground > pre > .bold { color: #FFFFFF; font-weight: normal; }
<span style="color: #d2d22a">──────────────────────────────────────────────────────
</span><span style="color: #d2d22a">modified: scripts/stackoverflow/inject.js
</span><span style="color: #d2d22a">──────────────────────────────────────────────────────
</span><span style="font-weight: bold; color: #E850A8">@ inject.js:33 @</span><span style="font-weight: bold; color: #E850A8"></span><span style="font-weight: bold; color: #7e7ea8"> chrome.storage.local.get(null, function (result) {</span>
Array.from(document.getElementsByTagName('pre')) // get all code snippets
.forEach(function (block) {
<span style="font-weight: bold; color: #aa0000"> block.addEventListener('dblclick', function (event) {</span>
// Reference: http://stackoverflow.com/a/6462980/3485241
@chrissound
chrissound / gist:93d0815231ff9102f82b2b2ce7dbe58f
Created March 28, 2018 13:00
zsh oh my zsh random colour per terminal
prompt_randomCol() {
if [[ -z "${PROMPTRANDOMCOL1-}" ]]; then
PROMPTRANDOMCOL1=$(($RANDOM % 256))
PROMPTRANDOMCOL2=$(($RANDOM % 256))
PROMPTRANDOMCOL3=$(($RANDOM % 256))
PROMPTRANDOMCOL4=$(($RANDOM % 256))
randsh=$(($RANDOM % 4))
if [ "$randsh" = "0" ]; then
vagrant up
Bringing machine 'k8s-01' up with 'virtualbox' provider...
Bringing machine 'k8s-02' up with 'virtualbox' provider...
Bringing machine 'k8s-03' up with 'virtualbox' provider...
==> k8s-01: Importing base box 'bento/ubuntu-16.04'...
==> k8s-01: Matching MAC address for NAT networking...
==> k8s-01: Checking if box 'bento/ubuntu-16.04' is up to date...
==> k8s-01: Setting the name of the VM: kubespray_k8s-01_1524071264719_65627
==> k8s-01: Clearing any previously set network interfaces...
==> k8s-01: Preparing network interfaces based on configuration...