Skip to content

Instantly share code, notes, and snippets.

@EinPinsel
EinPinsel / howto.sh
Created October 21, 2016 21:13 — forked from Maddosaurus/howto.sh
Create OPenVPN cert
# become root
sudo su -
# change dir to easy rsa
cd /etc/openvpn/easy-rsa
# source the environment vars
source ./vars
# create a new cert
@EinPinsel
EinPinsel / zshrc
Last active September 14, 2022 19:56
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh
# Theme
ZSH_THEME="pygmalion"
# Uncomment the following line to use case-sensitive completion.
CASE_SENSITIVE="true"
# Uncomment the following line to use hyphen-insensitive completion. Case
$uri = 'https://api.netatmo.com/oauth2/token'
$body = @{
"client_id" = "ClientID";
"client_secret" = "ClientSecret";
"grant_type" = "password";
"username" = "Mail";
"password" = "Password"
}
$uri = 'https://api.netatmo.com/oauth2/token'
function Netatmo-DoAuth {
$postParams = @{
grant_type='password';
client_id=$client_id;
client_secret=$client_secret;
username=$Netatmo_username;
password=$Netatmo_password
}
$Request = Invoke-WebRequest -Uri https://api.netatmo.com/oauth2/token -Method POST -Body $postParams -UseBasicParsing
#------------------------------------------------------------------------------
# THIS CODE AND ANY ASSOCIATED INFORMATION ARE PROVIDED “AS IS” WITHOUT
# WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
# LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS
# FOR A PARTICULAR PURPOSE. THE ENTIRE RISK OF USE, INABILITY TO USE, OR
# RESULTS FROM THE USE OF THIS CODE REMAINS WITH THE USER.
#------------------------------------------------------------------------------
$global:access_token = $null
$global:refresh_token = $null
#Netatmo Details. Client ID and secret from creating the App, and a username and password that has access to the api.
mklink /d D:\TEMP\Spotify C:\Users\<username>\AppData\Local\Spotify
$Mac = "1A:2B:3C:4D:5E:6F"
$MacByteArray = $Mac -split "[:-]" | ForEach-Object { [Byte] "0x$_"}
[Byte[]] $MagicPacket = (,0xFF * 6) + ($MacByteArray  * 16)
$UdpClient = New-Object System.Net.Sockets.UdpClient
$UdpClient.Connect(([System.Net.IPAddress]::Broadcast),7)
$UdpClient.Send($MagicPacket,$MagicPacket.Length)
$UdpClient.Close()
# Remove duplicate lines
^(.*)(\r?\n\1)+$ -> Replace with $1
# Get the third octett of an IP-Adress:
\b\d{1,3}\.\d{1,3}\.\K\d{1,3}(?=\.\d{1,3}\b)
@EinPinsel
EinPinsel / Upload-Mods-to-SFTP-Server.ps1
Created February 8, 2017 19:12
Upload-Factorio-Mods to a SFTP Server from Windows
# Save Factorio-Mod-Pack and probably upload it to a http server via sftp
# Assume "normal" installation
$SftpServer = 'server.blah.com'
$UserName = 'username'
$KeyFile = '$env:userprofile\key.pem' # Make sure the keyfile has no password, because posh-ssh is not ready yet
$SftpPath = '/var/www/mods.server.blah.com'
$FilePath = "$env:appdata\factorio\_mods.zip"
# Create an empty Credential-Object because reasons. (to be honest: posh-ssh is not ready yet)
@EinPinsel
EinPinsel / Microsoft.PowerShell_profile.ps1
Last active October 1, 2018 07:15
Powershell Profile for Proxy Configuration from IE
# Make install of modules a little bit more easier
$PSDefaultParameterValues['Install-Module:Scope'] = 'CurrentUser'
# For VS:Code
$ErrorActionPreference = "Silentlycontinue"
# Make the shell nice and h4x0r-style
$Shell = $Host.UI.RawUI
$Shell.BackgroundColor="Black"