Skip to content

Instantly share code, notes, and snippets.

@enricostano
enricostano / shift_register.rs
Last active May 13, 2016
Playing with shift registers with Rust + ARMv7 + GPIO
View shift_register.rs
extern crate sysfs_gpio;
use sysfs_gpio::{Direction,Pin};
use std::time::Duration;
use std::thread::sleep;
fn main() {
let data_pin = Pin::new(18); // SER #14
let latch_pin = Pin::new(23); // RCLK #12
let clock_pin = Pin::new(24); // SRCLK #11
@diniremix
diniremix / dockersetup.MD
Last active Sep 22, 2016
setup docker on elementary OS freya
View dockersetup.MD

instalar docker

instalar una imagen (ubuntu 14.04 en este caso)

  • sudo docker run ubuntu:14.04

revisar las imagenes instaladas

  • sudo docker images

entrar en la imagen recien creada

@rye
rye / vomit.ru
Last active Jan 30, 2017
A Ruby web server to act like Python's SimpleHTTPServer module.
View vomit.ru
#!/usr/bin/env rackup
#\ -E deployment
use Rack::ContentLength
app = Rack::Directory.new Dir.pwd
run app
@thaJeztah
thaJeztah / index.md
Last active Jan 24, 2018
Ubuntu or Alpine? A quick comparison
View index.md

Ubuntu ... or Alpine? A quick comparison

Let's see how they compare with a minimal example: run an image that installs curl and pulls the Holberton homepage

Ubuntu

Pull the ubuntu:16.04 image

@rabbitt
rabbitt / schema_clone.py
Last active Feb 21, 2019
PostgreSQL schema cloner (including data).
View schema_clone.py
import psycopg2 as pg
from io import BytesIO
from collections import defaultdict
from contextlib import contextmanager
from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT, ISOLATION_LEVEL_READ_COMMITTED
READ_COMMIT = ISOLATION_LEVEL_READ_COMMITTED
AUTO_COMMIT = ISOLATION_LEVEL_AUTOCOMMIT
View websocket_bencmark.md

Crystal vs Node.js Websocket Benchmark

Crystal 0.9.1 with Kemal

require "kemal"

ws "/" do |socket|
  socket.on_message do |message|
  end
@strzibny
strzibny / unused_routes.rb
Created May 5, 2016
Find unused routes in Rails
View unused_routes.rb
#!/usr/bin/env ruby
# Extracted from traceroute gem + checking the presence of views as well
require_relative './config/environment.rb'
class Traceroute
def initialize(app)
@app = app
end
@jrichardsz
jrichardsz / sheet-to-api-rest-v1.js
Last active May 28, 2020
google sheet spreadsheet as api rest using google app script or feeds
View sheet-to-api-rest-v1.js
var sheetName = "data01";
var sheetId = "1i3xaxavcxks4SbGv-rsd4SJ-Lk";
var book = SpreadsheetApp.openById(sheetId);
var sheet = book.getSheetByName(sheetName);
function doGet(request) {
var json = convertSheet2JsonText(sheet);
@terrancesnyder
terrancesnyder / setenv.sh
Created May 23, 2011
./setenv.sh - example setenv.sh with defaults set for minimal time spent in garbage collection
View setenv.sh
#! /bin/sh
# ==================================================================
# ______ __ _____
# /_ __/___ ____ ___ _________ _/ /_ /__ /
# / / / __ \/ __ `__ \/ ___/ __ `/ __/ / /
# / / / /_/ / / / / / / /__/ /_/ / /_ / /
#/_/ \____/_/ /_/ /_/\___/\__,_/\__/ /_/
# Multi-instance Apache Tomcat installation with a focus
# on best-practices as defined by Apache, SpringSource, and MuleSoft
@funzoneq
funzoneq / simplehttp.service
Created May 25, 2016
A systemd file for a python SimpleHTTPServer
View simplehttp.service
[Unit]
Description=Job that runs the python SimpleHTTPServer daemon
Documentation=man:SimpleHTTPServer(1)
[Service]
Type=simple
WorkingDirectory=/tmp/letsencrypt
ExecStart=/usr/bin/python -m SimpleHTTPServer 80 &
ExecStop=/bin/kill `/bin/ps aux | /bin/grep SimpleHTTPServer | /bin/grep -v grep | /usr/bin/awk '{ print $2 }'`
You can’t perform that action at this time.