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
all: libbaz.so libbar.so foo | |
# libbaz depends on libm | |
libbaz.so: libbaz.h libbaz.c | |
gcc -o $@ -shared -fPIC -lm $^ | |
# libbar depends on libbaz | |
libbar.so: libbar.h libbar.c | |
gcc -o $@ -L. -Wl,-rpath=. -lbaz -shared -fPIC $^ |
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 | |
def word(w): | |
def f(tokens): | |
return tokens[1:] if len(tokens) > 0 and tokens[0] == w else False | |
return f | |
def zero_or_more(parser): | |
def f(tokens): | |
if len(tokens) == 0: |
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
#!/bin/bash | |
mask() { | |
local bytes=$((($2+3)/4)) | |
local remaining=$((bytes%8)) | |
local groups=$((bytes/8)) | |
local s=$(printf "%0${bytes}x" $((1<<$1))) | |
local rc=${s::$remaining} | |
s=${s:$remaining} | |
while [ -n "$s" ]; do |
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
se std::{mem, ptr}; | |
fn swap_ptr(p1: &mut *mut Vec<i32>, p2: &mut *mut Vec<i32>) { | |
let mut p3: *mut Vec<i32> = ptr::null_mut(); | |
p3 = *p1; | |
*p1 = *p2; | |
*p2 = p3; | |
} | |
fn 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
struct S; | |
impl S { | |
fn foo(&self) { println!("S::foo"); } | |
fn bar(&self) { println!("S::bar"); } | |
} | |
fn foo() { println!("foo"); } | |
fn bar() { println!("bar"); } |
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
use std::boxed::Box; | |
#[derive(Debug, PartialEq)] | |
enum N { | |
V(Vec<Box<N>>), | |
S(Box<N>), | |
C(i32), | |
} | |
macro_rules! t { |
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
int load_bpf(int mod) | |
{ | |
int map_fd; | |
map_fd = bpf_create_map(BPF_MAP_TYPE_ARRAY, sizeof(int), | |
sizeof(uint64_t), 1); | |
if (map_fd < 0) { | |
log_error("creating BPF map failed"); | |
return map_fd; | |
} |
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 bash | |
name=$(basename $0) | |
usage="link files/directories to destination.\n\ | |
usage: $name [-i|-p] <src> <abs dst dir>\n\ | |
-i\task before overwriting\n\ | |
-p\tpreview operations before executing\n" | |
confirm='' |
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
#include <stdio.h> | |
struct P1 { int i; char c; long j; char d; }; | |
struct P2 { long j; char c; char d; int i; }; | |
struct P3 { short w[3]; char c[3]; }; | |
struct P4 { short w[3]; char *c[3]; }; | |
struct P5 { struct P1 a[2]; struct P2 *p; }; | |
int 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
echo -e "\e[1;31m __ _._.,._.__\e[0m" | |
echo -e "\e[1;31m .o8888888888888888P'\e[0m" | |
echo -e "\e[1;31m .d88888888888888888K\e[0m" | |
echo -e "\e[1;31m ,8 888888888888888888888boo._\e[0m" | |
echo -e "\e[1;31m :88b 888888888888888888888888888b.\e[0m" | |
echo -e "\e[1;31m \`Y8b 88888888888888888888888888888b.\e[0m" | |
echo -e "\e[1;31m \`Yb. d8888888888888888888888888888888b\e[0m" | |
echo -e "\e[1;31m \`Yb.___.88888888888888888888888888888888888b\e[0m" | |
echo -e "\e[1;31m \`Y888888888888888888888888888888CG88888P\"'\e[0m" | |
echo -e "\e[1;31m \`88888888888888888888888888888MM88P\"'\e[0m" |