Skip to content

Instantly share code, notes, and snippets.

@g3rhard
g3rhard / otrs.agi
Created November 15, 2016 07:39
AGI connector with OTRS
#!/usr/bin/perl
#
# AGI connector with OTRS
#
# Written by: Kiriru Trofimov <[email protected]>
#
#initialize
use Asterisk::AGI;
use SOAP::Lite;
param(
[string]$id,
[string]$message
)
$bot_token = "token"
$uri = "https://api.telegram.org/bot$bot_token/sendMessage"
Invoke-WebRequest -Method Post -Uri $uri -ContentType "application/json;charset=utf-8" -Body (ConvertTo-Json -Compress -InputObject @{chat_id=$id; text=$message})
@g3rhard
g3rhard / rc.local
Created December 13, 2016 04:38
OpenWRT rc.local for advertising block
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
# http://paul.is-a-geek.org/2015/06/dns-based-adblock-using-openwrt-opendns-and-dnsmasq/
#!/bin/sh
#Block ads, malware, etc.
logger -t "adblock" -s 'Starting adblock setup...'
#Delete the old adblock_hosts to make room for the updates
rm /tmp/adblock_hosts
@g3rhard
g3rhard / redmine_create_custom_issue.sh
Last active December 23, 2016 05:08
create issues in Redmine with Redmine API and issues.json
#!/bin/bash
PROJECT="$1"
TRACKER="$2"
STATUS="$3"
PROJECT_ID="$4"
SUBJECT="$5"
PRIORITY_ID="$6"
curl -H 'X-Redmine-API-Key: <api-key>' \
-H 'Content-Type: application/json' \
@g3rhard
g3rhard / unattend_windows_2016.xml
Created May 17, 2017 04:12
Файл ответов для Sysprep после установки Windows Server 2016
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="specialize">
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<AutoLogon>
<Password>
<Value>admin</Value>
<PlainText>true</PlainText>
</Password>
<Enabled>true</Enabled>
April 2017
Skype For Business 2015 Server
http://care.dlservice.microsoft.com/dl/download/9/3/4/934A5259-809B-4E36-BD2C-37DEF262C20A/SfB-E-9319.0-ruRU.ISO
Windows 2016 HyperV Server
http://care.dlservice.microsoft.com/dl/download/0/9/0/090CFA39-E9A3-4711-97DC-17E13723236F/14393.0.161119-1705.RS1_REFRESH_SERVERHYPERCORE_OEM_X64FRE_RU-RU.ISO
Windows 2016 Server Essentials
http://care.dlservice.microsoft.com/dl/download/9/3/A/93A216B3-927A-47B1-ADDA-574E02F7B371/14393.0.161119-1705.RS1_REFRESH_SERVERESSENTIALS_OEM_X64FRE_RU-RU.ISO
@g3rhard
g3rhard / l2tp_strongswan_notes.md
Last active June 5, 2017 11:25 — forked from psanford/meraki_strongswan_notes.md
connect to vpn from strongswan (ubuntu 16.04 edition)

These are my notes for connecting to a meraki client vpn from ubuntu 16.04. This configuration assumes you are using a psk for the ipsec auth.

Install the following packages:

apt-get install -y strongswan xl2tpd

Configure strong swan

@g3rhard
g3rhard / fill_users.ps1
Created June 5, 2017 13:36
Добавление пользователей Active Directory средствами PowerShell
Import-CSV -delimiter "," c:\Temp\users.csv | foreach {
New-ADUser -SamAccountName $_.SamAccountName -GivenName $_.GivenName -Surname $_.Surname -Name $_.Name `
-Path "DC=domain,DC=local" `
-AccountPassword (ConvertTo-SecureString -AsPlainText $_.Password -Force) -Enabled $true -PasswordNeverExpires $true -Description $_.description -DisplayName $_.DisplayName -userPrincipalName $_.userPrincipalName
}
@g3rhard
g3rhard / ssh-telegram.sh
Last active July 7, 2018 08:00 — forked from matriphe/ssh-telegram.sh
Bash Script to notify via Telegram Bot API when user log in SSH
# save it as /etc/profile.d/ssh-telegram.sh
# or place it in your scripts directory, for example /var/scripts
# and paste in /etc/ssh/sshrc this line:
# /var/scripts/ssh-telegram.sh
# use jq to parse JSON from ipinfo.io
# get jq from here http://stedolan.github.io/jq/
USERID="<target_user_id>"
KEY="<bot_private_key>"
TIMEOUT="10"
URL="https://api.telegram.org/bot$KEY/sendMessage"
@g3rhard
g3rhard / get_temperature_openhardware.ps1
Last active June 15, 2017 08:51
Get temperature with OpenHardwareMonitor (http://openhardwaremonitor.org/) and Powershell and WMI
$temp = get-wmiobject -namespace root\OpenHardwareMonitor -query 'select Value from Sensor WHERE Identifier LIKE "/intelcpu/0/temperature/0"'
echo $temp.value