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
struct CovariantExample<'a, T> { | |
a: &'a T | |
} | |
struct InvariantExample<'a, T> { | |
a: &'a mut T | |
} | |
fn covarient() { |
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
#![feature(dropck_eyepatch)] | |
use std::alloc::Layout; | |
use std::ops::{Deref, DerefMut}; | |
// use std::marker::PhantomData; | |
struct InHeap<T: Sized> { | |
ptr: *const T, | |
//_m: PhantomData<T> // Using PhantomData will prevent "unsound usage" | |
} |
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 | |
prog=$(basename $0) | |
if [ ! -f build/envsetup.sh ]; then | |
echo ${prog}: Please cd to the directory you ran \'repo init\' in. | |
exit 1 | |
fi | |
source build/envsetup.sh |
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 | |
# tailcsv.py is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# tailcsv.py is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
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 controlled_recursion(default=None, depth=0): | |
def entangle(f): | |
lock = threading.Lock() | |
f.call_counts = {} | |
def increment(): | |
with lock: | |
call_count = f.call_counts.get(threading.currentThread().ident, 0) | |
call_count += 1 | |
f.call_counts[threading.currentThread().ident] = call_count |
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 | |
# PyPrintLogger is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# PyPrintLogger is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
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 | |
# PyDaemonize is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# PyDaemonize is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
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 | |
# This file is part of PyArgumentParser. | |
# PyArgumentParser is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# PyArgumentParser is distributed in the hope that it will be useful, |
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
[runtime.host] | |
hostname = "Optiplex-3020" | |
username = "vignesh" | |
codeset = "UTF-8" | |
cpus = 4 | |
cache_dir = "/home/vignesh/.cache" | |
data_dir = "/home/vignesh/.local/share" | |
config_dir = "/home/vignesh/.config" | |
runtime_dir = "/run/user/1000" | |
home_dir = "/home/vignesh" |