This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Retrieve AWS instrance's commonly used metadata. Require curl. | |
# ./get-metadata help | |
# ./get-metadata id | |
# Input is case insensitive; format to uppper case to generate self-help page. | |
info=${1^^} | |
meta_data_url=http://169.254.169.254/latest/meta-data/ | |
roleProfile=$(curl -s http://169.254.169.254/latest/meta-data/iam/info \ | |
| grep -Eo 'instance-profile/([a-zA-Z.-]+)' | sed 's#instance-profile/##') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// | |
double distance_on_geoid(double lat1, double lon1, double lat2, double lon2) { | |
// Convert degrees to radians | |
lat1 = lat1 * M_PI / 180.0; | |
lon1 = lon1 * M_PI / 180.0; | |
lat2 = lat2 * M_PI / 180.0; | |
lon2 = lon2 * M_PI / 180.0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// use shift registers(74HC595) to control an insane amount of digital inputs. | |
// https://www.youtube.com/watch?v=nXl4fb_LbcI | |
#include <SPI.h> | |
byte Input, Output, Check=1; | |
int j; | |
void setup(){ | |
pinMode(13, OUTPUT);//clock | |
pinMode(11, OUTPUT);//data | |
pinMode(4, OUTPUT);//latch | |
pinMode(2, INPUT);//Input from buttons |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2018/12/06 20:40:09 - $0=10 (step pulse, usec) | |
2018/12/06 20:40:09 - $1=25 (step idle delay, msec) | |
2018/12/06 20:40:09 - $2=0 (step port invert mask:00000000) | |
2018/12/06 20:40:09 - $3=5 (dir port invert mask:00000101) | |
2018/12/06 20:40:09 - $4=0 (step enable invert, bool) | |
2018/12/06 20:40:09 - $5=0 (limit pins invert, bool) | |
2018/12/06 20:40:09 - $6=0 (probe pin invert, bool) | |
2018/12/06 20:40:09 - $10=3 (status report mask:00000011) | |
2018/12/06 20:40:09 - $11=0.020 (junction deviation, mm) | |
2018/12/06 20:40:09 - $12=0.002 (arc tolerance, mm) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
#Installing v4l-utils (debian) gives one the handy v4l2-ctl command: | |
$ v4l2-ctl --list-devices | |
HPigh Definition Webcam (usb-0000:00:14.0-11): | |
/dev/video2 | |
UVC Camera (046d:0821) (usb-0000:00:14.0-13): | |
/dev/video0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from gpiozero import LED | |
from time import sleep | |
step = LED(4) | |
dir = LED(3) | |
step = LED(17) | |
dir = LED(18) | |
wait = 0.000051 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Stel de GPIO pinnen in voor de stappenmotor: | |
import sys | |
import time | |
import RPi.GPIO as GPIO | |
# Use BCM GPIO references | |
# instead of physical pin numbers | |
GPIO.setmode(GPIO.BCM) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import RPi.GPIO as GPIO | |
import time | |
import os | |
shutdownPin = 14 | |
GPIO.setmode(GPIO.BCM) | |
GPIO.setup(shutdownPin,GPIO.IN, pull_up_down=GPIO.PUD_UP) | |
while True: | |
pinStatus = GPIO.input(shutdownPin) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Stel de GPIO pinnen in voor de stappenmotor: | |
import sys | |
import time | |
import RPi.GPIO as GPIO | |
# Use BCM GPIO references | |
# instead of physical pin numbers | |
GPIO.setmode(GPIO.BCM) | |
StepPins = [23,24,25,4] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
############################################## | |
# The MIT License (MIT) | |
# Copyright (c) 2016 Kevin Walchko | |
# see LICENSE for full details | |
############################################## | |
from pyservos import Packet | |
from pyservos.servoserial import ServoSerial | |
import pyservos |
OlderNewer