Skip to content

Instantly share code, notes, and snippets.

Avatar
🤗
Hugs

Matthias mre

🤗
Hugs
View GitHub Profile
@mre
mre / top2.json
Created Jan 4, 2021
Top Github Users by followers October 2020
View top2.json
[
{
"data": {
"search": {
"userCount": 2646,
"edges": [
{
"node": {
"login": "torvalds",
"followers": {
@mre
mre / pyenv install -v 3.6.5
Created Jul 17, 2018
pyenv install -v 3.6.5
View pyenv install -v 3.6.5
+ [pyenv:22] enable -f /usr/local/bin/../libexec/pyenv-realpath.dylib realpath
+ [pyenv:29] '[' -z '' ']'
++ [pyenv:31] type -p greadlink readlink
++ [pyenv:31] head -1
+ [pyenv:31] READLINK=/usr/local/bin/greadlink
+ [pyenv:32] '[' -n /usr/local/bin/greadlink ']'
+ [pyenv:54] '[' -z '' ']'
+ [pyenv:55] PYENV_ROOT=/Users/mendler/.pyenv
+ [pyenv:59] export PYENV_ROOT
+ [pyenv:62] '[' -z '' ']'
View lib.rs
#[cfg(test)]
#[macro_use]
extern crate proptest;
extern crate chrono;
use chrono::prelude::*;
use std::convert::From;
use std::num::ParseIntError;
@mre
mre / gist:301153a121caa310f7c11c21cc2bf5dc
Created May 18, 2018
building stdgba with latest nightly
View gist:301153a121caa310f7c11c21cc2bf5dc
cargo build ✘ 130
Compiling g v0.1.0 (file:///Users/mendler/Code/snippets/rust/g)
Compiling gbaimg v0.1.0 (file:///Users/mendler/Code/snippets/rust/g/gbaimg)
warning: unused import: `Term`
--> gbaimg/src/lib.rs:8:43
|
8 | use proc_macro::{ TokenStream, TokenTree, Term };
| ^^^^
|
= note: #[warn(unused_imports)] on by default
@mre
mre / main.rs
Created Mar 9, 2018
A simple clone of `ls -l` in Rust
View main.rs
extern crate chrono;
extern crate libc;
#[macro_use]
extern crate structopt;
use std::fs;
use std::path::PathBuf;
use std::error::Error;
use std::process;
use std::os::unix::fs::PermissionsExt;
@mre
mre / main.c
Created Jan 2, 2018
Darwin/macOS copyfile example usage
View main.c
#include <copyfile.h>
int main()
{
copyfile("test.txt", "copy.txt", 0, COPYFILE_ALL);
}
View each.rb
["Ruby", "Rust", "Python", "Cobol"].each do |lang|
puts "Hello #{lang}!"
end
@mre
mre / cat.rs
Created Nov 6, 2017
A `cat` implemenation written in Rust using output buffering and stdio locking
View cat.rs
#[macro_use]
extern crate error_chain;
use std::env;
use std::fs::File;
use std::io::{self, BufReader, Read, Write};
pub const BUFFER_CAPACITY: usize = 64 * 1024;
error_chain! {
@mre
mre / fib.rs
Created Oct 27, 2017
Fibonacci Parallel Rust
View fib.rs
extern crate threadpool;
extern crate num_cpus;
use threadpool::ThreadPool;
use std::sync::mpsc::channel;
fn fib_real(number: u64) -> u64 {
match number < 2 {
true => number,
false => run(number - 1) + run(number - 2),