Skip to content

Instantly share code, notes, and snippets.

View Indavelopers's full-sized avatar

Marcos Manuel Ortega Indavelopers

View GitHub Profile
#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,
apiVersion: batch/v1
kind: Job
metadata:
name: demo-job
spec:
template:
metadata:
name: demo-job
spec:
containers:
# 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.
@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)
@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_led_pwm.py
Last active June 6, 2017 11:38
Control LED intensity through PWM
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
PIN_LED = 12
GPIO.setup(PIN_LED, GPIO.OUT)
p = GPIO.PWM(PIN_LED, 50)
@Indavelopers
Indavelopers / rpi_led.py
Last active June 6, 2017 15:09
LED by pin up/down
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
GPIO.setup(12, GPIO.OUT)
try:
while True:
GPIO.output(12, True)
time.sleep(0.5)
@Indavelopers
Indavelopers / rpi_adc_2inputs.py
Last active June 6, 2017 10:25
Get data from 2 analog inputs simultanely
#!/usr/bin/env python
import time
import os
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
# Read SPI data from MCP3008
def readadc(adcnum, clockpin, mosipin, misopin, cspin):
#!/usr/bin/env python
import time
import os
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
# Read SPI data from MCP3008
def readadc(adcnum, clockpin, mosipin, misopin, cspin):
@Indavelopers
Indavelopers / rpi_pushbutton_threaded.py
Last active June 5, 2017 17:21
Ejecucción en multihilo
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings(False)
PIN_BUTTON = 16
GPIO.setup(PIN_BUTTON, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)