Skip to content

Instantly share code, notes, and snippets.

View Indavelopers's full-sized avatar

Marcos Manuel Ortega Indavelopers

View GitHub Profile
@Indavelopers
Indavelopers / rpi_led_potentiometer.py
Last active June 6, 2017 15:53
Control a LED intensity though PWM and a potentiometer
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
# Read SPI data from MCP3008
def readadc(adcnum, clockpin, mosipin, misopin, cspin):
if ((adcnum > 7) or (adcnum < 0)):
raise ValueError('ADC num between 0 and 7')
@Indavelopers
Indavelopers / rpi_dc_motor.py
Last active June 6, 2017 16:32
Control speed and direction of a DC motor.
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
PIN_MOTOR1 = 2
PIN_MOTOR2 = 3
PIN_MOTOR3 = 4
GPIO.setup(PIN_MOTOR1, GPIO.OUT)
# Preview more ports on Cloud Shell
By default, GCP Cloud Shell allows us to preview local servers on ports 8080 through 8084. These are often the default ports used for previsualizing.
[Docs](https://cloud.google.com/shell/docs/features#web_preview) are clear about this, but sometimes we need or find more convenient to use ports in a different range.
## Exammple
By default, Google App Engine SDK (for standard environment's Python runtime at least) uses port 8000 for the admin local server dashboard, so it seems we can't access it without changing it to another port first.
apiVersion: batch/v1
kind: Job
metadata:
name: demo-job
spec:
template:
metadata:
name: demo-job
spec:
containers:
#standardSQL
SELECT
ST_GeogPoint(longitude, latitude) AS point,
name,
iso_time,
dist2land,
usa_wind,
usa_pressure,
usa_sshs,
(usa_r34_ne + usa_r34_nw + usa_r34_se + usa_r34_sw)/4 AS radius_34kt,