Skip to content

Instantly share code, notes, and snippets.

View stepancheg's full-sized avatar

Stepan Koltsov stepancheg

View GitHub Profile
template <typename T>
class foo {};
int main() {
foo<1> x;
return 0;
}
===
#!/usr/bin/env python
import sys
import threading
import os
class MyThread(threading.Thread):
def run(self):
sys.exit(1)
#include <execinfo.h>
#include <sys/time.h>
#include <stdio.h>
void foo(int i) {
if (i == 0) {
void* array[128];
backtrace(array, 128);
} else {
foo(i - 1);
" from http://vim.wikia.com/wiki/Highlight_unwanted_spaces
highlight ExtraWhitespace ctermbg=lightgray guibg=lightgray
autocmd ColorScheme * highlight ExtraWhitespace ctermbg=lightgray guibg=lightgray
match ExtraWhitespace /\s\+$/
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
autocmd InsertLeave * match ExtraWhitespace /\s\+$/
function! ResCur()
if line("'\"") <= line("$")
normal! g`"
return 1
endif
endfunction
augroup resCur
autocmd!
autocmd BufWinEnter * call ResCur()
import printer.*;
import unix;
record LargeRecord (
a: Array[RawPointer, 1024],
);
foo() {
var a = LargeRecord();
// call any function that is guaranteed to be not inlined
#include <stdio.h>
#include <unistd.h>
struct large_struct {
void* a[1024];
};
static void foo() {
struct large_struct r;
// call any function that is guaranteed to be not inlined
import printer.*;
private external backtrace(array:Pointer[RawPointer], size:Int) : Int;
record Backtrace (
callstack: Array[RawPointer, 128],
);
showBacktraceMine() {
var bt = Backtrace();
@stepancheg
stepancheg / gist:3388855
Created August 18, 2012 18:22
Full error
###############################
overload GenericOSError?(#GenericOSError) = true;
[E, I, S when GenericOSError?(E) and Integer?(I) and StringLiteral?(S)]
-----------------------------^
overload E(code:I, #S) --> returned:E {
returned.code = Int(code);
###############################
/Users/yozh/devel/left/clay/lib-clay/os/errors/errors.clay(13,29): error: unholy recursion detected
# tested in zsh
# Don't try this at home.
command_not_found_handler() {
replaced=false
set -A args "$@"
# aliases like gcc-O2='gcc -O2'