Skip to content

Instantly share code, notes, and snippets.

View Misiu's full-sized avatar

Tomasz Misiu

  • 17:55 (UTC +02:00)
View GitHub Profile
@Misiu
Misiu / scan_for_i2c_devices
Created June 30, 2020 08:31 — forked from kungpfui/scan_for_i2c_devices
Scan for I2C devices with smbus2 library (like i2cdetect)
#!/usr/bin/env python3
from smbus2 import SMBus
def scan(force=False):
devices = []
for addr in range(0x03, 0x77 + 1):
read = SMBus.read_byte, (addr,), {'force':force}
write = SMBus.write_byte, (addr, 0), {'force':force}
@Misiu
Misiu / ZipNugetPackages.ps1
Created January 7, 2019 10:23
Nuspec & Nupkg versioning
Param(
[Parameter(mandatory=$true)]
[string]$packagesDirectory
)
$compressDirectory =
{
param($directoryPath, $destinationPath)
Compress-Archive -path "$directoryPath\*" -DestinationPath $destinationPath -Force
}
@Misiu
Misiu / ApplyVersionToAssemblies.ps1
Created January 7, 2019 10:23
Nuspec & Nupkg versioning
##-----------------------------------------------------------------------
## <copyright file="ApplyVersionToAssemblies.ps1">(c) Microsoft Corporation.
## This source is subject to the Microsoft Permissive License.
## See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
## All other rights reserved.</copyright>
##-----------------------------------------------------------------------
# Look for a 0.0.0.0 pattern in the build number.
# If found use it to version the assemblies.
#
# For example, if the 'Build number format' build process parameter
@Misiu
Misiu / UnzipNugetPackages.ps1
Created January 7, 2019 10:23
Nuspec & Nupkg versioning
Param(
[Parameter(mandatory=$true)]
[string]$packagesDirectory
)
$expandZipFile =
{
param($zipFile, $zipDestinationPath)
Expand-Archive -path "$zipFile" -DestinationPath $zipDestinationPath -Force
}
#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#include <ArduinoOTA.h>
#include <FS.h>
#include <ESPAsyncTCP.h>
#include <ESPAsyncWebServer.h>
#include "SPI.h"
#include "SD.h"
@Misiu
Misiu / FooEnvironmentBuilder.cs
Created May 22, 2017 06:29 — forked from zbynourcz/FooEnvironmentBuilder.cs
Topshelf custom environment builder
class FooEnvironmentBuilder : EnvironmentBuilder
{
readonly HostConfigurator _configurator;
WindowsHostEnvironment _windowHostEnvironment;
public FooEnvironmentBuilder(HostConfigurator configurator)
{
_configurator = configurator;
_windowHostEnvironment = new WindowsHostEnvironment(_configurator);
}
using System;
using System.ServiceModel.Channels;
using System.Xml;
namespace DokZastrzezoneV3
{
public class CustomTextMessageBindingElement : MessageEncodingBindingElement
{
private MessageVersion _msgVersion;
private string _mediaType;