Related Setup: https://gist.github.com/hofmannsven/6814278
Related Pro Tips: https://ochronus.com/git-tips-from-the-trenches/
| 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(): |
Related Setup: https://gist.github.com/hofmannsven/6814278
Related Pro Tips: https://ochronus.com/git-tips-from-the-trenches/
| $currentBranch = git rev-parse --abbrev-ref HEAD | |
| git checkout dev | |
| git pull | |
| git checkout $currentBranch | |
| git merge dev |
| # | |
| # This script will increment the build number in a file | |
| # refactored from the AssemblyInfo.cs version incrementing gist for use with AndroidManifest.xml | |
| # | |
| #$assemblyInfoPath = "C:\Data\Temp\AssemblyInfo.cs" | |
| $mani = "C:\Data\Temp\AndroidManifest.xml" | |
| #$contents = Get-Content $assemblyInfoPath # looses file formatting | |
| $contents = [System.IO.File]::ReadAllText($mani) |
| using System; | |
| using System.Collections; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| // using System.Timers; | |
| using Xamarin.Forms; | |
| namespace ....Core.Control | |
| { | |
| public class CarouselLayout : ScrollView, IDisposable |
| using System; | |
| using System.Threading; | |
| using System.Threading.Tasks; | |
| namespace ....Core.Control { | |
| // https://github.com/jamesmontemagno/FrenchPressTimer/blob/master/SimpleTimerPortable/Timer.cs | |
| internal delegate void TimerCallback(object state); | |
| internal sealed class Timer : CancellationTokenSource, IDisposable { | |
| public Timer(TimerCallback callback, object state, int dueTime, int period) { |
| <?xml version="1.0" encoding="utf-8" ?> | |
| <derived:BasePage xmlns="http://xamarin.com/schemas/2014/forms" | |
| xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | |
| x:Class="....AboutPage" | |
| xmlns:local="clr-namespace:...;assembly=..." | |
| xmlns:derived="clr-namespace:....View;assembly=..." | |
| BindingContext="{x:Static local:App.AboutViewModel}" | |
| Title="About"> | |
| <StackLayout Orientation="Vertical" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"> | |
| <Label Text="{Binding Detail}"/> |
| namespace ... { | |
| // for supporting this | |
| // public partial class "Derived"Page : "Derived"PageXaml {.... } for a xaml/cs page | |
| // then | |
| // <?xml version="1.0" encoding="utf-8" ?><local:"Derived"tPageXaml xmlns="ht... | |
| // with this bit in the cs file | |
| // public partial class "Derived"PageXaml : BasePageOverrideBackButton<ViewModel."Derived"ViewModel> { } | |
| public class BasePageOverrideBackButton<T> : BasePage<T> where T : ViewModel.BaseViewModel, new() { | |
| public BasePageOverrideBackButton() : base() { | |
| } |
| namespace ... { | |
| public abstract class BaseViewModel : BindableObject { // yeah its overkill, can't recall why my colleague did it this way | |
| private string title = string.Empty; | |
| public string Title { | |
| get { return title; } | |
| set { | |
| if(title != value) { | |
| title = value; | |
| RaisePropertyChanged(); |
| # Disable Smart Card PnP | |
| # [x86] | |
| # [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\ScPnP] | |
| # "EnableScPnP"=dword:00000000 | |
| # [64-bit] | |
| # HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\ScPnP] | |
| # "EnableScPnP"=dword:00000000 | |
| # this Wow6432Node entry is a "hardlink" to the above entry, so you create/delete/edit that and the changes are mirrored in Wow6432Node |