This file contains hidden or 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 split_logic(): | |
print('hello') | |
yield | |
print('world') | |
yield # just to suppress the exception in the second .next | |
gen = split_logic() | |
gen.next() | |
print('event') | |
gen.next() |
This file contains hidden or 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
# Set up the prompt | |
autoload -Uz promptinit | |
promptinit | |
prompt adam1 | |
setopt histignorealldups sharehistory | |
# Use emacs keybindings even if our EDITOR is set to vi | |
bindkey -e |
This file contains hidden or 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
mod common { | |
pub trait MyTrait { | |
fn get(&self) -> int; | |
} | |
} | |
mod specific { | |
pub struct MyStruct { | |
value: int | |
} | |
impl MyStruct { |
This file contains hidden or 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
(gdb) python | |
>import signal | |
>def handler(sig, frame): | |
> print 'sig:', sig, 'frame:', frame | |
>signal.signal(signal.SIGALRM, handler) | |
>end | |
(gdb) python | |
>signal.alarm(10) | |
>import time | |
>time.sleep(20) |
This file contains hidden or 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 <sys/stat.h> | |
#include <cerrno> | |
#include <cstdio> | |
#include <cstring> | |
// never declare a variable of this type, only use it as the return type of a function. | |
class OptionalError | |
{ | |
const char *msg; |
This file contains hidden or 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
int foo(bool c, int x, int n) { | |
while (n > 0) { | |
n--; | |
if (c) { | |
x += 2; | |
} | |
x += 3; | |
} | |
return x; | |
} |
This file contains hidden or 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
#!/bin/bash -eu | |
# autoupdate and restart a tmwa-map server | |
## config is now in tmwa-map-wrapper-config | |
## utilities | |
trap 'echo EXIT $? >&2' EXIT | |
# prevent interaction | |
export GIT_EDITOR=: |
This file contains hidden or 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 python | |
from __future__ import print_function | |
for line in open('db/item_db.txt'): | |
if not line.strip(): | |
continue | |
if line.startswith('//'): | |
continue | |
ID, Name, Label, Type, Price, Sell, Weight, ATK, DEF, Range, Mbonus, Slot, Gender, Loc, wLV, eLV, View, scripts = line.split(',', 17) | |
Name = Name.strip() |
This file contains hidden or 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
// amd64 | |
typedef unsigned long size_t; | |
void *tor_realloc(void *, size_t); | |
typedef struct smartlist_t { | |
/** @{ */ | |
/** <b>list</b> has enough capacity to store exactly <b>capacity</b> elements | |
* before it needs to be resized. Only the first <b>num_used</b> (\<= | |
* capacity) elements point to valid data. |
This file contains hidden or 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 <memory> | |
#include <vector> | |
struct Model | |
{ | |
virtual ~Model() {} | |
}; | |
struct PositionedModel : public Model | |
{ |