Skip to content

Instantly share code, notes, and snippets.

View RedTahr's full-sized avatar

Allister RedTahr

  • New Zealand
View GitHub Profile
from gpiozero import LED, MotionSensor, LightSensor
from signal import pause
pir = MotionSensor(21)
ldr = LightSensor(26)
light = LED(25)
def daytime():
pir.when_motion = None
pir.when_no_motion = None
light.off()
def nighttime():
@rponte
rponte / get-latest-tag-on-git.sh
Last active December 9, 2024 00:27
Getting latest tag on git repository
# The command finds the most recent tag that is reachable from a commit.
# If the tag points to the commit, then only the tag is shown.
# Otherwise, it suffixes the tag name with the number of additional commits on top of the tagged object
# and the abbreviated object name of the most recent commit.
git describe
# With --abbrev set to 0, the command can be used to find the closest tagname without any suffix:
git describe --abbrev=0
# other examples
@chrisriesgo
chrisriesgo / CarouselViewWithVMViews.cs
Created July 12, 2015 15:37
An example showing how to have dynamic item templates driven off of the bound viewmodels.
public class App : Application
{
public IEnumerable<ICarouselViewModel> _pages;
public App()
{
_pages = new List<ICarouselViewModel>()
{
new PageOneViewModel(),
new PageTwoViewModel()

Git Cheat Sheet

Commands

Getting Started

git init

or

@ZevEisenberg
ZevEisenberg / resetAllSimulators.sh
Last active December 23, 2024 19:57
Reset all iOS simulators with this one weird trick
osascript -e 'tell application "iOS Simulator" to quit'
osascript -e 'tell application "Simulator" to quit'
xcrun simctl erase all
@bradjolicoeur
bradjolicoeur / gist:e77c508089aea6614af3
Created August 8, 2014 20:15
Powershell Script to Increment Build Number in AssemblyInfo.cs
#
# This script will increment the build number in an AssemblyInfo.cs file
#
$assemblyInfoPath = "C:\Data\Temp\AssemblyInfo.cs"
$contents = [System.IO.File]::ReadAllText($assemblyInfoPath)
$versionString = [RegEx]::Match($contents,"(AssemblyFileVersion\("")(?:\d+\.\d+\.\d+\.\d+)(""\))")
Write-Host ("AssemblyFileVersion: " +$versionString)
@hofmannsven
hofmannsven / README.md
Last active August 27, 2024 09:08
Raspberry Pi Cheatsheet
@hofmannsven
hofmannsven / README.md
Last active April 30, 2025 15:25
Git CLI Cheatsheet