Skip to content

Instantly share code, notes, and snippets.

View gleicon's full-sized avatar

Gleicon Moraes gleicon

View GitHub Profile
@acolyer
acolyer / service-checklist.md
Last active January 30, 2024 17:39
Internet Scale Services Checklist

Internet Scale Services Checklist

A checklist for designing and developing internet scale services, inspired by James Hamilton's 2007 paper "On Desgining and Deploying Internet-Scale Services."

Basic tenets

  • Does the design expect failures to happen regularly and handle them gracefully?
  • Have we kept things as simple as possible?
@fiorix
fiorix / proxy.go
Created June 27, 2014 03:31
HTTP reverse proxy that uses Redis for vhost routing.
// HTTP reverse proxy that uses Redis for vhost routing.
//
// ADDR=:8080 REDIS=127.0.0.1:6379 go run proxy.go
// redis-cli set localhost:8080 http://sports.yahoo.com
// curl -v localhost:8080
package main
import (
"errors"
@danrigsby
danrigsby / packer-ami-id
Last active December 14, 2023 15:07
Get AMI ID from a packer build
packer build packer.json 2>&1 | sudo tee output.txt
tail -2 output.txt | head -2 | awk 'match($0, /ami-.*/) { print substr($0, RSTART, RLENGTH) }' > sudo ami.txt
@fiorix
fiorix / gist:9927296
Created April 2, 2014 03:03
Reading sequential pcap payload in Go
func pcapReader(filename string) (io.ReadCloser, error) {
pr, pw, err := os.Pipe()
if err != nil {
return nil, err
}
handle, err := pcap.OpenOffline(filename)
if err != nil {
return nil, err
}
@skarllot
skarllot / make-icpbrasil-bundle.sh
Last active January 23, 2024 03:02
Download ICP-Brasil certificates and make a bundle
#!/bin/bash
HTTPADDR=http://acraiz.icpbrasil.gov.br/credenciadas/CertificadosAC-ICP-Brasil/ACcompactado.zip
DEST=/etc/ssl/certs/icp-brasil
mkdir -p ${DEST}
cd ${DEST}
rm -f *.crt
rm -f *.zip
@ysimonson
ysimonson / gist:5877284
Last active February 22, 2016 19:56
LinkedIn OAuth2 authentication over tornado
from tornado import auth, httpclient, httputil, escape
import urllib.request
import urllib.parse
import urllib.error
import functools
REQUEST_TIMEOUT = 20.0
class LinkedInMixin(auth.OAuth2Mixin):
@stemid
stemid / brew.py
Created July 24, 2012 14:07
Homebrew module for ansible
#!/usr/bin/python -tt
# (c) 2012, Stefan Midjich
# Written by Stefan Midjich <swehack@gmail.com>
#
# This module was written for Ansible.
# It doesn't support all of Homebrew yet.
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
## PP IPN
class PaypalIPNHandler(BaseHandler):
def get(self):
#print self.request
self.render("error.html")
def post(self):
try:
self.write("thanks")
status = self.get_argument("payment_status")
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <hiredis/libevent.h>
void getCallback(redisContext *c, redisReply *reply, const void *privdata) {
printf("argv[%s]: %s\n", (const char*)privdata, reply->reply);
/* Disconnect after receiving the reply to GET */
redisDisconnect(c);
;; pattern matching em CL é meio assim gents:
;; exemplo classics
(defgeneric fact (n))
(defmethod fact ((n (eql 0)))
1)
(defmethod fact ((n number))
(* n (fact (- n 1))))