Skip to content

Instantly share code, notes, and snippets.

@CosminLazar
CosminLazar / UGW3_Wireguard.md
Last active February 25, 2024 22:48 — forked from xirixiz/UGW3_Wireguard.md
Ubiquiti USG configuration for Wireguard

The purpouse is to have a WireGuard server running with a configuration for 2 clients to connect to the WireGuard server.

Installation - First steps

Follow the instructions for downloading and installing the WireGuard package here: https://github.com/WireGuard/wireguard-vyatta-ubnt

curl -OL https://github.com/WireGuard/wireguard-vyatta-ubnt/releases/download/${RELEASE}/${BOARD}-${RELEASE}.deb
sudo dpkg -i ${BOARD}-${RELEASE}.deb
Connect to a bluetooth speaker
sudo bluetoothctl
power on
pairable on
agent on
default-agent
scan on
pair xx:xx:xx:xx:xx:xx
trust xx:xx:xx:xx:xx:xx
@CosminLazar
CosminLazar / mosquitto.service
Created October 19, 2018 18:33
Systemd service for Mosquitto
[Unit]
Description=Mosquitto MQTT Broker daemon
ConditionPathExists=/etc/mosquitto/mosquitto.conf
After=network.target
Requires=network.target
[Service]
Type=forking
RemainAfterExit=no
StartLimitInterval=0
#include <DHTSensor.h>
DHTSensor sensor(3);//Will be using pin3 for collecting the data
void loop()
{
DHTSensorMeasurement re = sensor.Read();
if (!re.HasError())
{
Serial.print("H: ");
Serial.print(re.Humidity());
Serial.print(" T: ");
public interface IHaveDeferredEnumerable
{
IEnumerable<IHaveDeferredEnumerable> Get();
}
public class HasDeferredEnumerable : IHaveDeferredEnumerable
{
public IEnumerable<IHaveDeferredEnumerable> Get()
{
yield return null;
#pragma once
#define TALKFX_ZONE_AMBIENT 0x00
#define TALKFX_ZONE_EVENT 0x01
#define TALKFX_EFFECT_OFF 0x00
#define TALKFX_EFFECT_ON 0x01
#define TALKFX_EFFECT_BLINKING 0x02
#define TALKFX_EFFECT_BREATHING 0x03
#define TALKFX_EFFECT_HEARTBEAT 0x04
Install-Package NuGetDebugTools
Add-Debugger.ps1
Set-PSBreakpoint -Command init.ps1, install.ps1, uninstall.ps1
$x86TalkFX = $project.ProjectItems.Item("CroccatTalkWrapper").ProjectItems.Item("win32-x86").ProjectItems.Item("talkfx-c.dll");
$x86TalkFX.Properties.Item("BuildAction").Value = [int]2;
@CosminLazar
CosminLazar / WrongInstall.ps1
Created February 21, 2015 21:25
How not to modify the project from Install.ps1
#This script edits the project file and marks the talkfx-c.dll files to always be copied to the output directory
param($installPath, $toolsPath, $package, $project)
# Load project XML.
$doc = New-Object System.Xml.XmlDocument
$doc.Load($project.FullName)
$namespace = 'http://schemas.microsoft.com/developer/msbuild/2003'
# Find the node containing the file. The tag "Content" may be replace by "None" depending of the case, check your .csproj file.
$talkFXDlls = Select-Xml "//msb:Project/msb:ItemGroup/msb:Content[contains(@Include, 'talkfx-c.dll')]" $doc -Namespace @{msb = $namespace}
@CosminLazar
CosminLazar / RavenDBExtensions.cs
Created May 19, 2014 10:17
Extension class adding FirstOrDefaultLazy to RavenDB
public static class RavenDBExtensions
{
public static Lazy<T> FirstOrDefaultLazy<T>(this IQueryable<T> query, Func<T, bool> predicate)
{
if (query == null) throw new ArgumentNullException("query");
if (predicate == null) throw new ArgumentNullException("predicate");
return query.Where(x => predicate(x)).FirstOrDefaultLazy();
}