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 typing import Dict, Union, NewType | |
Foo = NewType("Foo", str) | |
Bar = NewType("Bar", int) | |
def get_data() -> Dict[str, Union[Foo, Bar]]: | |
return {"foo": Foo("one"), "bar": Bar(2)} | |
def process(foo_value: Foo, bar_value: Bar) -> None: | |
pass |
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
def ask_int(question): | |
"""Ask a question and return an integer.""" | |
while True: | |
try: | |
return int(input(question)) | |
except ValueError: | |
print("Not a number, please try again.") |
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
import os | |
import time | |
print("forking...") | |
pid = os.fork() | |
print("done!") | |
if pid == 0: | |
print("hello, I am the child") | |
else: | |
print("hello, I am the parent") |
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
-- USAGE: create an Automator service that receives selected text and put this in "Run AppleScript" | |
on run {input, parameters} | |
choose from list {"Alex", "Daniel", "Ewa", "Samantha", "Serena", "Thomas", "Zosia", "Bad News", "Good News", "Pipe Organ"} with prompt "Choose voice:" without multiple selections allowed and empty selection allowed | |
set voice to the result as string | |
say input using voice | |
return input | |
end run |
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
#!/usr/bin/env python3 | |
from __future__ import print_function | |
def f(n, level=0): | |
indent = level * ' ' | |
print(indent, 'start', n) | |
if n == 10202: | |
print(indent, 'return constant from', n) | |
return 4 |
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
--- for.s 2016-12-08 20:00:37.121281039 +0100 | |
+++ while.s 2016-12-08 20:00:38.705280904 +0100 | |
@@ -1,4 +1,4 @@ | |
- .file "for.c" | |
+ .file "while.c" | |
.intel_syntax noprefix | |
.text | |
.globl main |
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 functools import wraps | |
def dec(f): | |
@wraps(f) | |
def wrapper(i): | |
print("wrapper") | |
return f(i) | |
return wrapper |
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
floppy.bin: kernel.c stage1.asm stage2.asm | |
gcc kernel.c -std=c99 -nostdlib -o kernel64 | |
strip kernel64 | |
nasm stage1.asm | |
nasm stage2.asm | |
dd if=/dev/zero bs=1 count=$((512-$(stat --printf="%s" stage1))) >> stage1 | |
cat stage1 stage2 kernel64 > floppy.bin | |
bash -c 'fsize=$$(stat --printf="%s" floppy.bin); if [[ $$(($$fsize%512)) != 0 ]]; then dd if=/dev/zero bs=1 count=$$((512-($$fsize%512))) >> floppy.bin; fi' |
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
<?php | |
/* | |
Plugin Name: Meta2 Widget | |
Description: Meta2 Widget. | |
*/ | |
class WP_Widget_Meta2 extends WP_Widget { | |
/** | |
* Sets up a new Meta widget instance. | |
* |
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
[user] | |
name = Chris Warrick | |
email = kwpolska@gmail.com | |
username = Kwpolska | |
[color] | |
ui = 1 | |
diff = auto | |
status = auto | |
branch = auto | |
[github] |