Skip to content

Instantly share code, notes, and snippets.

Avatar

Conrad cpdean

View GitHub Profile
View fibonacci_indent_prototype.py
def fib(n):
if n in (0, 1):
return 1
return fib(n-1) + fib(n - 2)
def fib_better(n):
if n == 0:
return 0
return fib(n - 1) + fib_better(n - 1)
View test.txt
james@archx1c6g ➜ write-test git:(master) ✗ cat ./src/main.rs
use std::io::Write;
fn main() {
for _ in 0..10 {
writeln!(
::std::io::stdout().lock(),
"Hello, world!"
).unwrap_or_else(|_| {
eprintln!("stderr: Hello, stderr!");
View gist:c9e50ec80691ce5da9f2edaf61a73227
- ❯❯❯ python3
Python 3.7.1 (default, Nov 6 2018, 18:45:35)
[Clang 10.0.0 (clang-1000.11.45.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> def goat(n: int) -> str:
... """ an goat str """
... return 'goat'
...
>>> print(goat.__doc__)
an goat str
View decider.py
i>>> import random
>>> ['do it', 'no', 'no', 'no'][random.randrange(4)]
'no'
>>> ['do it', 'no', 'no', 'no'][random.randrange(4)]
'no'
>>> ['do it', 'no', 'no', 'no'][random.randrange(4)]
'no'
>>> ['do it', 'no', 'no', 'no'][random.randrange(4)]
'no'
>>> ['do it', 'no', 'no', 'no'][random.randrange(4)]
@cpdean
cpdean / fix-it.sh
Last active Jan 31, 2018
setting global logging for your users is a terrible transgression
View fix-it.sh
(tmp-d03b8292d70950f0) - - -
tmp-d03b8292d70950f0 0
- ❯❯❯ python
Python 2.7.13 (default, Jul 18 2017, 09:17:00)
[GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import warnings
>>> warnings.filterwarnings('ignore')
>>> import sklearn.cross_validation
@cpdean
cpdean / build-all.sh
Last active Jan 2, 2018
crawl a directory of nodejs projects
View build-all.sh
#!/bin/bash
REPOS=$(find . -type d -depth 1)
for i in $REPOS; do
echo building $i
cd $i
git pull
rm -rf node_modules
yarn install
cd -
done
@cpdean
cpdean / flashing.md
Created Dec 2, 2017
preonic flash output
View flashing.md
    *** QMK Toolbox (http://qmk.fm/toolbox)
        Supporting following bootloaders:
         - DFU (Atmel, LUFA) via dfu-programmer (http://dfu-programmer.github.io/)
         - Caterina (Arduino, Pro Micro) via avrdude (http://nongnu.org/avrdude/)
         - Halfkay (Teensy, Ergodox EZ) via teensy_loader_cli (https://pjrc.com/teensy/loader_cli.html)
         - STM32 (ARM) via dfu-util (http://dfu-util.sourceforge.net/)
         - Kiibohd (ARM) via dfu-util (http://dfu-util.sourceforge.net/)
    *** DFU device connected
    *** Attempting to flash, please don't remove device
@cpdean
cpdean / preonic.txt
Created Nov 22, 2017
easy reference of preonic default layout
View preonic.txt
Qwerty
,-----------------------------------------------------------------------------------.
| ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
|------+------+------+------+------+------+------+------+------+------+------+------|
| Tab | Q | W | E | R | T | Y | U | I | O | P | Del |
|------+------+------+------+------+-------------+------+------+------+------+------|
| Esc | A | S | D | F | G | H | J | K | L | ; | " |
|------+------+------+------+------+------|------+------+------+------+------+------|
| Shift| Z | X | C | V | B | N | M | , | . | / |Enter |
|------+------+------+------+------+------+------+------+------+------+------+------|
View types.ml
(* how is this: *)
type value = [
| `Assoc of (string * value) list
| `Bool of bool
| `Float of float
| `Int of int
| `List of value list
| `Null
| `String of string
]
@cpdean
cpdean / README.md
Last active Feb 28, 2016
dynamic network
View README.md
You can’t perform that action at this time.