Skip to content

Instantly share code, notes, and snippets.

View Clijsters's full-sized avatar

Dominique Clijsters Clijsters

View GitHub Profile
@Clijsters
Clijsters / TIBDel.bat
Last active October 19, 2015 19:18
Deletes all TIB-Files except the newest one. Removes meta Folder.
::Acronis Backups bereinigen. Neuestes behalten, meta-Folder löschen.
Set DatSich=F:
cd %DatSich%\ && %DatSich%
for /f %%i in ('dir /b /o-D /a-d /tC "%DatSich%\*.tib"^|more /e +1') do del /f /s /q %%i
rd /s /q %DatSich%\meta
@Clijsters
Clijsters / ASCIIToBin.ps1
Last active August 29, 2015 13:56
Convert ASCII to Bin - Powershell Script
$delimiter = "";
$filePath = "C:\test\mytextfile.txt"
$BinFile = "C:\test\numbers.txt"
[string]$char = Get-Content $filePath
$char.ToCharArray() | foreach {([BYTE][CHAR]$_)} | Out-File $BinFile
@Clijsters
Clijsters / HexToASCII.ps1
Created February 18, 2014 22:30
Convert HEX to ASCII Powershell Script
$delimiter = " ";
$filePath = "C:\myHexFile.txt"
$ASCIIFile = "C:\newFile.txt"
$HEX = Get-Content $filePath
$HEX.Split($delimiter) | FOREACH {WRITE-HOST –object ( [BYTE][CHAR]([CONVERT]::toint16($_,16))) –nonewline >> Out-File $ASCIIFile}
@Clijsters
Clijsters / NodeJS_YQL.js
Last active October 19, 2015 22:04
-UPDATED- Get Data from API with Node.JS
var strQuery = encodeURIComponent('select * from yahoo.finance.historicaldata where symbol = "GOOG"');
var url = 'http://query.yahooapis.com/v1/public/yql?q=' + strQuery + '&format=JSON&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=';
var data = ''; //Will hold JSON String
var request = http.get(url, function(res) {
console.log("HTTP Response Status" + res.statusCode);
res.on("data", function(chunk) {
if(res.statusCode == 200){
console.log('Adding Data to buffer...');
data += chunk;
} else {
@Clijsters
Clijsters / UsersFromCSV.sh
Created February 18, 2014 22:48
Create multiple users from CSV input file
#!/bin/bash
USERFILE=/Pfad/Datei.csv
OLDIFS=$IFS
IFS=,
[ ! -f $INPUT ] && { echo "Datei $USERFILE nicht vorhanden."; exit 99; }
while read name passwort
do
adduser name --shell /bin/bash
echo passwort | passwd uname --stdin
@Clijsters
Clijsters / MSExchange_mailSize.ps1
Created March 2, 2014 10:23
Small snippet for increasing mail size limits
Set-DistributionGroup
-MaxReceiveSize Unlimited
-MaxSendSize Unlimited
Set-DynamicDistribution Group
-MaxReceiveSize Unlimited
-MaxSendSize Unlimited
Set-Mailbox
-MaxReceiveSize Unlimited
@Clijsters
Clijsters / preventShutdown.vb
Created December 21, 2014 17:44
Windows prevent shutdown - intercept Windows Message WM_QUERYENDSESSION
' The following code sample demonstrates how to prevent Windows from shutting down
' by intercepting Windows Messages, read WM_QUERYENDSESSION and return WM_CANCELMODE
Public Class Form1
Private Const WM_QUERYENDSESSION As System.Int32 = &H11
Private Const WM_CANCELMODE As System.Int32 = &H1F
Dim MyMsg As New Message
@Clijsters
Clijsters / beep.vb
Created December 21, 2014 18:00
beep tone through internal beeper
Module Module1
Dim a, b As Long
Declare Sub Beep Lib "kernel32.dll" (ByVal tone As Integer, ByVal dauer As Integer)
Public Function Rand(ByVal Low As Long, _
ByVal High As Long) As Long
Rand = Int((High - Low + 1) * Rnd()) + Low
End Function
Sub Main()
Console.Write( _
@Clijsters
Clijsters / pingBereich.bat
Created December 21, 2014 18:27
pings a range of adresses
@echo off
:Dieses Script pingt alle Hosts in einem IP-Bereich an und listet antwortende Hosts auf.
if exist ips.txt del ips.txt > nul
echo Bitte geben Sie den ersten Teil der IP ein (z.B. 192.168.0):
set /p ip=
for /L %%N IN (1, 1, 254) DO (
echo %ip%.%%N wird nun angepingt
@Clijsters
Clijsters / WaitForAC.bat
Last active July 29, 2016 18:25
Requires the machine to be on AC Power before execution starts
@echo off
:test
wmic path win32_battery get batterystatus | find "2"
if %ERRORLEVEL% neq 0 (
echo Kein AC! Warte auf Strom
goto :while
)
goto :run