Skip to content

Instantly share code, notes, and snippets.

View pczarn's full-sized avatar
🇵🇱
Proland

Peter Blackson pczarn

🇵🇱
Proland
  • Poland
  • 05:12 (UTC +02:00)
View GitHub Profile
@ttscoff
ttscoff / lazylink.rb
Created October 19, 2013 18:56
Marked 2 Preprocessor for "lazy links"
@pabigot
pabigot / rotate.cc
Created November 19, 2013 18:52
C++11 template function to perform integer rotations without invoking undefined behavior. See http://blog.regehr.org/archives/1063
/* See http://blog.regehr.org/archives/1063
*/
#include <type_traits>
#include <cstdint>
#include <limits>
#include <typeinfo>
#ifndef ARGTYPE
#define ARGTYPE uint32_t
#endif /* ARGTYPE */
@edwardw
edwardw / gist:7587876
Created November 21, 2013 19:20
Boot to Rust in OS X

Booting to Rust by Eric Holk! It is just mind-bogglingly cool. What else can I say? His enhancement to Rust has been landed so it is time for me to try that out, in OS X. The setup of the toolchain could be a little bit challenging.

First and foremost, check out the latest Rust with win64 calling convention contributed by Eric Holk and build it.

Then prepare the cross linker.

$ wget http://ftpmirror.gnu.org/binutils/binutils-2.23.2.tar.gz
$ tar xvzf binutils-2.23.2.tar.gz
$ cd binutils-2.23.2
$ mkdir dist
@jvns
jvns / interview-questions.md
Last active April 17, 2025 16:25
A list of questions you could ask while interviewing

A lot of these are outright stolen from Edward O'Campo-Gooding's list of questions. I really like his list.

I'm having some trouble paring this down to a manageable list of questions -- I realistically want to know all of these things before starting to work at a company, but it's a lot to ask all at once. My current game plan is to pick 6 before an interview and ask those.

I'd love comments and suggestions about any of these.

I've found questions like "do you have smart people? Can I learn a lot at your company?" to be basically totally useless -- everybody will say "yeah, definitely!" and it's hard to learn anything from them. So I'm trying to make all of these questions pretty concrete -- if a team doesn't have an issue tracker, they don't have an issue tracker.

I'm also mostly not asking about principles, but the way things are -- not "do you think code review is important?", but "Does all code get reviewed?".

@mcpherrinm
mcpherrinm / instructions.md
Last active September 6, 2024 05:10
Crosscompiling Rust to Arm

I want to write Rust code on my computer (x86_64, Ubuntu 14.04) and produce arm executables. I found hints on the internet, but not a concise set of instructions on what to do. So I wrote them down exactly:

apt-get install g++-arm-linux-gnueabihf
git clone https://github.com/mozilla/rust.git
mkdir rust/build-cross
cd rust/build-cross
../configure --target=arm-unknown-linux-gnueabihf --prefix=$HOME/local/rust-cross
make -j8 && make install
@bgamari
bgamari / linked_list.rs
Last active July 16, 2017 14:05
An intrusive linked-list implementation in Rust
/*!
* Intrusive singly linked lists
*/
use std::option::{Option, Some, None};
use std::cell::{Cell};
#[deriving(Show)]
pub struct ListCell<'a, T>(Cell<Option<&'a T>>);
@pczarn
pczarn / README.md
Last active August 29, 2015 14:01
Layout analysis of Rust's structs

Struct layout: total space occupied by padding

(including drop flags and tail padding)

total padding (bytes) number of structs
0 641
1 6
2 7
3 15
use std::io;
fn main() {
println!("digraph \\{");
let mut input = io::stdin();
let mut lines = input.lines();
loop {
match lines.next() {
Some(line) => {
let line = line.unwrap();
let line = line.as_slice();
@kmcallister
kmcallister / gist:f19ac199bc3de8a4649d
Last active August 29, 2015 14:02
HTML token match macro
states::InHead => match_token!(token {
CharacterTokens(NotSplit, text) => Split(KeepWhitespace, text),
CharacterTokens(Whitespace, text) => append_text!(self.target(), text),
CommentToken(text) => append_comment!(self.target(), text),
tag @ <base> <basefont> <bgsound> <link> <meta> => {
self.create_element_nopush(tag.name, tag.attrs);
Done