Skip to content

Instantly share code, notes, and snippets.

View averri's full-sized avatar

Alexandre Verri averri

View GitHub Profile
@cfebs
cfebs / vboxhostonlyssh.md
Last active October 22, 2023 12:32
setup a vbox ubuntu server with host only adapter

Virtualbox dev environment w/ static IP

I can never find a great guide on this stuff, so these are more like notes to myself.

The goal here is to have a virtualbox running more or less headless. An ssh client is used separately to actually use the machine. I've found it to be fantastic for a quick dev setup.

lets go

Assumes you have a vbox setup with Ubuntu server (this will work for 16.04) ready to go.

@HokieGeek
HokieGeek / buspirate-bulkrom.py
Last active January 17, 2021 12:47
Trying out bus pirate binary mode in python and haskell
#!/usr/bin/python
import serial
import signal
import sys
import time
def BinaryModeEnter(connection):
connection.flushInput()
for x in range(0, 20): # Try at most 20 times
@brandoncurtis
brandoncurtis / AnalogReadSerial.ino
Last active January 29, 2024 20:47
Realtime Data Acquisition and Plotting with Arduino and Python
/*
AnalogReadSerial
Reads an analog input on pin 0, prints the result to the serial monitor.
Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.
This example code is in the public domain.
Upload this to the Arduino using the Arduino IDE!
*/
@whatnick
whatnick / Energy_Monitor_Real.ino
Last active October 1, 2022 20:10
ESP8266 Energy Monitor Real Power
/*
* This sketch sends ads1115 current sensor data via HTTP POST request to thingspeak server.
* It needs the following libraries to work (besides the esp8266 standard libraries supplied with the IDE):
*
* - https://github.com/adafruit/Adafruit_ADS1X15
*
* designed to run directly on esp8266-01 module, to where it can be uploaded using this marvelous piece of software:
*
* https://github.com/esp8266/Arduino
*
@kamermans
kamermans / configure_docker0.sh
Last active April 26, 2024 00:58
Change the IP subnet of Docker's docker0 interface
#!/bin/sh -e
#
# NOTE: Since Docker 1.10 (February 4, 2016), it has been possible to configure the
# Docker daemon using a JSON config file. On Linux, this file is normally located at
# /etc/docker/daemon.json. You should use this JSON config method if you are running
# a version of Docker that is at least 1.10!
# Here is an example configuration that sets the docker0 bridge IP to 192.168.254.1/24:
# {
# "bip": "192.168.254.1/24"
# }
@P7h
P7h / jdk_download.sh
Last active February 20, 2024 11:29
Script to download JDK / JRE / Java binaries from Oracle website from terminal / shell / command line / command prompt
##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### #####
### Shell script to download Oracle JDK / JRE / Java binaries from Oracle website using terminal / command / shell prompt using wget.
### You can download all the binaries one-shot by just giving the BASE_URL.
### Script might be useful if you need Oracle JDK on Amazon EC2 env.
### Script is updated for every JDK release.
### Features:-
# 1. Resumes a broken / interrupted [previous] download, if any.
# 2. Renames the file to a proper name with including platform info.
@stuart-warren
stuart-warren / apache2-logstash
Last active March 6, 2017 09:04
Apache2 logging config to output JSON in Logstash json_event format
# Create a log format called 'logstash_json' that emits, in json, the parts of an http
# request I care about. For more details on the features of the 'LogFormat'
# directive, see the apache docs:
# http://httpd.apache.org/docs/2.2/mod/mod_log_config.html#formats
# http://cookbook.logstash.net/recipes/apache-json-logs/
LogFormat "{ \"@timestamp\": \"%{%Y-%m-%dT%H:%M:%S%z}t\", \"@message\": \"%m %H %U%q %s\", \"@fields\": { \"client\": \"%a\", \"duration_usec\": %D, \"status\": %s, \"request\": \"%U%q\", \"method\": \"%m\", \"protocol\": \"%H\", \"referrer\": \"%{Referer}i\", \"user-agent\": \"%{User-agent}i\" } }" logstash_json
# Apache 2.4 adds sub-second precision logging
# http://httpd.apache.org/docs/2.4/mod/mod_log_config.html#formats
# LogFormat "{ \"@timestamp\": \"%{%Y-%m-%dT%H:%M:%S}t.%{msec_frac}t%{%z}t\", \"@message\": \"%m %H %U%q %s\", \"@fields\": { \"client\": \"%a\", \"duration_usec\": %D, \"status\": %s, \"request\": \"%U%q\", \"method\": \"%m\", \"protocol\": \"%H\", \"referrer\": \"%{Refer
@addyosmani
addyosmani / headless.md
Last active May 7, 2024 12:36
So, you want to run Chrome headless.

Update May 2017

Eric Bidelman has documented some of the common workflows possible with headless Chrome over in https://developers.google.com/web/updates/2017/04/headless-chrome.

Update

If you're looking at this in 2016 and beyond, I strongly recommend investigating real headless Chrome: https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md

Windows and Mac users might find using Justin Ribeiro's Docker setup useful here while full support for these platforms is being worked out.

@Niriel
Niriel / gist:5311471
Created April 4, 2013 15:37
A Python implementation of Arrows (such as seen in Haskell).
#! /usr/bin/python
"""Implementation of the arrow abstraction for functions.
Abstracting functions with Arrows has advantages. Arrows make it very easy to
compose functions (by simply 'multiplying' them with the `*` operator). The
order in which the arrows are written match the order of the computations,
making long pipelines easy to work with. Arrows also provide mechanisms for
creating and merging branches, which helps when a value needs to be consumed by
several functions, or when a function needs values from several sources. Arrows
can also support conditional application, selecting which of two functions f and
@sampsyo
sampsyo / pipeline.py
Created August 1, 2010 02:25
multithreaded pipelines for Python coroutines
"""Simple but robust implementation of generator/coroutine-based
pipelines in Python. The pipelines may be run either sequentially
(single-threaded) or in parallel (one thread per pipeline stage).
This implementation supports pipeline bubbles (indications that the
processing for a certain item should abort). To use them, yield the
BUBBLE constant from any stage coroutine except the last.
In the parallel case, the implementation transparently handles thread
shutdown when the processing is complete and when a stage raises an