Skip to content

Instantly share code, notes, and snippets.

View package.json
{
"dependencies": {
"express": "^4.16.4",
"selfsigned": "^1.10.4",
"spdy": "^4.0.0"
}
}
View terraform-upgrade.sh
#!/usr/bin/env bash
set -e
base_url="https://releases.hashicorp.com/terraform"
latest_version="$(curl --silent "https://releases.hashicorp.com/terraform/" | sed -ne 's/.*<a href="\/terraform\/\(.*\)\/".*/\1/p' | grep -v "rc\|beta" | head -n1)"
current_version="$(terraform -v | sed -ne 's/Terraform v\(.*\)/\1/p')"
if [ "$latest_version" != "$current_version" ]; then
View api.txt
GET / endpoints
GET /meetups index-meetups
POST /meetups create-meetup signed-in
GET /meetups/porto-codes show-meetup
PUT /meetups/porto-codes update-meetup owns-meetup-or-is-operator
POST /session send-login-email
GET /talks/porto-codes index-talks
@hugopeixoto
hugopeixoto / main.c
Last active Jun 13, 2017
simple color picker
View main.c
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/cursorfont.h>
#include <stdio.h>
int main() {
int x = 0;
int y = 0;
Display* display = NULL;
View components.people-list.js
import Ember from 'ember';
export default Ember.Component.extend({
filter: null,
filteredPeople: Ember.computed('people', 'filter', function() {
if (this.get("filter") === null) {
return this.get("people");
} else {
return this.get("people").filter(
(person) => parseInt(person.height, 10) <= this.get("filter"),
View es6.js
"use strict";
var Root = class {
constructor(name) { this.name = name; this.getName = this.getName.bind(this); }
getName() { return this.name; }
getNameOrig() { return this.name; }
};
var Child = class extends Root { }
View tico-test.sh
#!/usr/bin/env sh
assert() {
R="$(tico "$1")"
if [ ! "$R" = "$2" ]; then
echo "error on tico $1"
echo " expected $2"
echo " actual $R"
exit 1
fi
@hugopeixoto
hugopeixoto / xpto.sh
Created May 16, 2016
activate for python and npm
View xpto.sh
activate() {
py=".env/bin/activate"
[ -f "$py" ] && . "$py"
js="node_modules"
if [ -d "$js" ]; then
export _PREV_PATH_WITHOUT_NPM="$PATH"
export _PREV_PS1_WITHOUT_NPM="$PS1"
export PATH="$(npm bin):$PATH"
View movies.txt
1976 - Taxi Driver
1973-2005 - The Exorcist 1-5 - Complete Horror Anthology
1988-2012 - Red Dwarf DVD Boxset Season 1-8 + Extras
1990 - Misery
1995 - Higher Learning
2002-2012 - The Bourne Collection
2005 - Thank You for Smoking
2005 - Meatball Machine
2006 - Paprika
2006 - Aachi and Ssipak
@hugopeixoto
hugopeixoto / sample.rs
Last active Nov 23, 2015
rust FRP piston mashup
View sample.rs
extern crate piston;
extern crate graphics;
extern crate glutin_window;
extern crate opengl_graphics;
extern crate carboxyl;
use std::collections::HashSet;
use piston::window::WindowSettings;
use piston::event_loop::*;
use piston::input::*;