Skip to content

Instantly share code, notes, and snippets.

View tralamazza's full-sized avatar

Daniel Tralamazza tralamazza

View GitHub Profile
@tralamazza
tralamazza / Dockerfile
Last active February 16, 2018 22:35
embedded dev container
FROM base/devel
ENV XTENSA_TOOLCHAIN xtensa-esp32-elf-linux64-1.22.0-75-gbaf03c2-5.2.0
# init
RUN pacman -Suy --noconfirm
RUN pacman-key --init && \
update-ca-trust && \
pacman-db-upgrade
@thenickdude
thenickdude / sfinae.cpp
Created February 22, 2016 10:27
C++ SFINAE: Call a 2 argument constructor if it exists for a templated type, otherwise call the no-arg constructor
#include <iostream>
#include <type_traits>
#include <cstdint>
#include <cstddef>
// Or we can use enable_if from Boost:
template <bool, typename T = void>
struct enable_if {
};
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@kraft001
kraft001 / solarized.bash
Created June 8, 2012 05:47
solarized Gnome Terminal + Tmux + Vim
# store all solarized files in one place
mkdir ~/.solarized
cd ~/.solarized
# http://www.webupd8.org/2011/04/solarized-must-have-color-paletter-for.html
git clone https://github.com/seebi/dircolors-solarized.git
eval `dircolors ~/.solarized/dircolors-solarized/dircolors.256dark`
ln -s ~/.solarized/dircolors-solarized/dircolors.256dark ~/.dir_colors
git clone https://github.com/sigurdga/gnome-terminal-colors-solarized.git
UI frameworks
* https://github.com/appMobi/jQ.Mobi
* https://github.com/senchalabs/jQTouch
MVC frameworks
* https://github.com/documentcloud/backbone/
* http://spinejs.com/
* https://github.com/emberjs/ember.js
* https://github.com/SteveSanderson/knockout/
We’ve built a new communication protocol that sends messages with a restricted syntax.
We need to write a function which determines whether a given message is syntactically valid or not.
Here are the rules:
1. There are 15 valid characters in the protocol: the lower-case characters ‘a’ through ‘j’
and the uppercase characters ‘Z’, ‘M’, ‘K’, ‘P’, and ‘Q’.
2. Every lower-case character in isolation is a valid message, e.g., ‘a’ is a valid message.
3. If σ is a valid message then so is Zσ.
4. If σ and τ are valid messages then so are Mστ , Kστ , Pστ , and Qστ .
5. All other messages are invalid.
#!/bin/sh
#
# init.d script with LSB support.
#
# Copyright (c) 2007 Javier Fernandez-Sanguino <jfs@debian.org>
#
# This is free software; you may redistribute it and/or modify
# it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2,
# or (at your option) any later version.