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
#[test] | |
fn test_unsafe_shit() { | |
let data = vec![0u8; 16]; | |
let byteview = ByteView::from_vec(data); | |
let mut x = &[][..]; | |
let handle = ByteViewHandle::from_byteview(byteview, |bytes| -> Result<_, ()> { | |
x = bytes; | |
Ok(bytes) | |
}).unwrap(); | |
assert_eq!(x[0], 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
>>> def join(doc, other): | |
... return os.path.join(os.path.dirname(doc), other) | |
... | |
>>> join('foo/index.html', 'other.html') | |
'foo/other.html' | |
>>> join('foo/', 'other.html') | |
'foo/other.html' |
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
extern crate symbolic_symcache; | |
extern crate symbolic_debuginfo; | |
extern crate symbolic_common; | |
use std::env; | |
use std::fs; | |
use std::io::Read; | |
use symbolic_symcache::{SymCache, write_symcache, Line}; | |
use symbolic_debuginfo::FatObject; |
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
pub struct DedupMap<K, V> { | |
map: HashMap<K, V>, | |
} | |
impl<K, V> DedupMap<K, V> | |
where K: Eq + Hash, | |
V: From<usize> + ToOwned<Owned=V> + Clone, | |
{ | |
pub fn new() -> DedupMap<K, V> { | |
DedupMap { |
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
pub struct FatObject<'a> { | |
byteview: ByteView<'a>, | |
kind: FatObjectKind<'a>, | |
} | |
impl<'a> FatObject<'a> { | |
/// Provides a view to an object file from a byteview. | |
pub fn parse(byteview: ByteView<'a>) -> Result<FatObject<'a>> { | |
let kind = { | |
let buf = byteview.as_bytes(); |
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 fix_ssl(app): | |
def middleware(environ, start_response): | |
environ['wsgi.url_scheme'] = 'https' | |
return app(environ, start_response) | |
return middleware | |
app.wsgi_app = fix_ssl(app.wsgi_app) | |
app.config['PREFERRED_URL_SCHEME'] = 'https' |
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 path in paths { | |
for entry in WalkDir::new(path) { | |
if let Ok(entry) = entry { | |
/* do stuff here */ | |
} | |
} | |
} |
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
>>> class A(object): | |
... def __del__(self): | |
... pass | |
... | |
>>> class B(object): | |
... def __del__(self): | |
... pass | |
... | |
>>> a = A() | |
>>> a.b = B() |
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
$ pip install libsourcemap==0.7.0 | |
Collecting libsourcemap==0.7.0 | |
Could not find a version that satisfies the requirement libsourcemap==0.7.0 (from versions: 0.1.0, 0.2.0, 0.2.1, 0.2.2, 0.3.0, 0.3.1, 0.3.2, 0.4.0, 0.4.1, 0.4.2, 0.4.3, 0.4.4, 0.4.5, 0.5.0, 0.6.0) | |
No matching distribution found for libsourcemap==0.7.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
$ pip install libsourcemap | |
Collecting libsourcemap | |
Downloading libsourcemap-0.6.0-py2.py3-none-macosx_10_9_intel.whl (492kB) | |
100% |████████████████████████████████| 501kB 1.6MB/s | |
Collecting cffi>=1.6.0 (from libsourcemap) | |
Downloading cffi-1.10.0-cp27-cp27m-macosx_10_6_intel.whl (226kB) | |
100% |████████████████████████████████| 235kB 3.7MB/s | |
Collecting pycparser (from cffi>=1.6.0->libsourcemap) | |
Installing collected packages: pycparser, cffi, libsourcemap | |
Successfully installed cffi-1.10.0 libsourcemap-0.6.0 pycparser-2.17 |