Skip to content

Instantly share code, notes, and snippets.

View jtuttas's full-sized avatar

jtuttas jtuttas

  • http://www.mmbbs.de
View GitHub Profile
import paho.mqtt.client as mqtt
import json
from tweepy.streaming import StreamListener
from tweepy import OAuthHandler
from tweepy import Stream
#Variables that contains yours credentials to access Twitter API
access_token = ""
access_token_secret = ""
consumer_key = ""
$global:pw="geheim"
# Vor dem Start werden alte, registrierte Events geschlossen
Unregister-Event -SourceIdentifier *
# Initialisierung der Variablen
$global:Folder = "$PSScriptRoot\encoded"
$global:FolderOut = "$PSScriptRoot\decoded"
@jtuttas
jtuttas / mqtt.java
Created April 6, 2018 09:37
MQTT mit Java
package mmbbs;
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
import org.eclipse.paho.client.mqttv3.MqttCallback;
import org.eclipse.paho.client.mqttv3.MqttClient;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttMessage;
public class MQTT {
public static void main(String[] args) {
@jtuttas
jtuttas / mqtt.ps1
Created April 6, 2018 09:27
MQTT mit der Powershell
Add-Type -Path 'C:\Users\jtutt\OneDrive\bin\NuGet\M2Mqtt.4.3.0.0\lib\net45\M2Mqtt.Net.dll'
$MqttClient = [uPLibrary.Networking.M2Mqtt.MqttClient]("service.joerg-tuttas.de")
#
# Verbinden
$mqttclient.Connect([guid]::NewGuid())
Register-ObjectEvent -inputObject $MqttClient -EventName MqttMsgPublishReceived -Action {Write-host "Event Found Topic: $($args[1].topic) Message $([System.Text.Encoding]::ASCII.GetString($args[1].Message))"}
$mqttClient.Subscribe("esp32/temp",0)
$MqttClient.Publish("esp32/temp", [System.Text.Encoding]::UTF8.GetBytes("{temp:17}"))
@jtuttas
jtuttas / find.sh
Created March 20, 2018 08:11
Raspi find
#!/bin/bash
IP=$(ip addr show enxb827ebdbdca1 | awk '$1 == "inet" {gsub(/\/.*$/, "", $2); print $2}')
url="https://script.google.com/macros/s/AKfycby4En3zI_no0iIcczt8Je2_JL2b1sQFQExgHKrN-0YKNAxMWxI/exec?name=tuttas&ip=$IP"
echo $url
curl --request GET --url $url
@jtuttas
jtuttas / cron.ps1
Last active February 1, 2018 15:01
. $PSScriptRoot/pi.ps1
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Content-type", 'application/json')
$key = Get-Content $PSScriptRoot/key
$headers.Add("X-AIO-Key", $key)
$temp = get-Temperature -slave 0
$data = "" | Select-Object -Property "value"
$data.value=$temp.value
@jtuttas
jtuttas / get-MD4Hash.ps1
Last active September 20, 2017 11:42
Erzeugen eines MD4-Hashes (NTLM) aus einer String, Aufruf via: .\Get-MD4Hash.ps1 "geheim"
<#
.SYNOPSIS
This cmdlet returns the MD4 hash of the data that is input.
WARNING: MD4 is not secure, so it should NEVER be used to
protect sensitive data. This cmdlet is for research purposes only!
.DESCRIPTION
This cmdlet returns the MD4 hash of the data that is input.
WARNING: MD4 is not secure, so it should NEVER be used to
Import-Module "C:\Program Files\Microsoft System Center 2012 R2\Virtual Machine Manager\bin\psModules\virtualmachinemanager\virtualmachinemanager"
#Get-SCVMMServer -ComputerName 'mmbbs-vmm1' -UserRoleName 'Administrator'
$VLAN_ID = Read-Host 'Bitte VLAN ID z.B. 32 eingeben'
$SERVICE_Name = Read-Host 'Bitte VM name eingeben (* als Platzhalter)'
$vms= Get-SCVirtualMachine | Where-Object {$_.Name -like $SERVICE_Name}
$vms | foreach {
Import-Module "C:\Program Files\Microsoft System Center 2012 R2\Virtual Machine Manager\bin\psModules\virtualmachinemanager"
<#
.Synopsis
Löscht alle Snapshorts und erstellt einen Snapshot "base"
.DESCRIPTION
Löscht alle Snapshorts und erstellt einen Snapshot "base"
.EXAMPLE
Init Block for the named VM
init-block -vmname "linux"
set-psreadlineoption -t parameter darkblue
set-psreadlineoption -t operator darkblue
set-psreadlineoption -t string darkgreen
. (Resolve-Path "$env:LOCALAPPDATA\GitHub\shell.ps1")
. $env:github_posh_git\profile.example.ps1
function prompt
{
$l=get-location;
$f=$l.Path.Substring($l.Path.LastIndexOf("\"))
$l.Drive.Name+":\\.."+$f+ "> "