Skip to content

Instantly share code, notes, and snippets.

View stefanprodan's full-sized avatar
🎯
Hacking on @fluxcd and timoni.sh

Stefan Prodan stefanprodan

🎯
Hacking on @fluxcd and timoni.sh
View GitHub Profile
@stefanprodan
stefanprodan / MonitorEndpoints.ps1
Last active September 18, 2018 04:15
Calling ASP.NET Web API endpoints at regular intervals can be easily done using Windows Task Scheduler and PowerShell’s Invoke-RestMethod. The following script makes a GET call for each supplied endpoint, if a call fails then the endpoint’s URL and the error details are sent to Windows Application Event Log.
#############################################
##
## Monitor ASP.NET WebAPI Enpoints
## Author: Stefan Prodan
## Date : 7 Apr 2014
## Company: VeriTech.io
#############################################
#Base url
$urlPrefix = "http://localhost/MyApp.Server/";
@stefanprodan
stefanprodan / MinifyTaskFolderDeploy.xml
Last active January 13, 2018 22:06
MSBuild Task that minifies all js files in Script folder using YUI and RequireJsNet.Compressor
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="JavaScriptCompressorTask" AssemblyFile="$(MSBuildProjectDirectory)\$(OutputPath)RequireJsNet.Compressor.dll" />
<!--Folder deploy-->
<Target Name="MinifyForBuild" AfterTargets="CopyAllFilesToSingleFolderForPackage" Condition="'$(Configuration)'=='Release'">
<MsBuild Projects="$(MSBuildProjectFile)" Targets="Minify" Properties="RootDir=$(_PackageTempDir)" />
<Message Text="Minifying for build" Importance="high"/>
</Target>
<Target Name="Minify" Condition="'$(Configuration)'=='Release'">
@stefanprodan
stefanprodan / MonitorEndpointsAzure.js
Last active August 29, 2015 14:04
Use Azure Mobile Service Scheduler to monitor websites: create a table named 'sites' with the following columns: id, name, url, keyword, status, statusDate and statusCode.
function Monitor() {
var sites = tables.getTable('Sites');
sites.read({ success: function(results) {
results.forEach(function(site) {
var httpRequest = require('request');
httpRequest.get(site.url, function(err, response, body) {
//check response status
@stefanprodan
stefanprodan / Backup-Postgres.ps1
Last active March 22, 2023 04:28
PostgreSQL cluster base backup automation made easy with PowerShell and Windows Task Scheduler or PgAgent. This script does the following: checks if there is enough free space to make a new backup (based on the last backup size), purges expired backups, creates a new folder for each backup, calls pb_basebackup to begin a tar gzip backup of every…
#############################################
##
## PostgreSQL base backup automation
## Author: Stefan Prodan
## Date : 20 Oct 2014
## Company: VeriTech.io
#############################################
# path settings
$BackupRoot = 'C:\Database\Backup';
@stefanprodan
stefanprodan / Install-Postgres.psm1
Created October 20, 2014 12:04
PostgreSQL unattended install PowerShell module
#################################################################################
##
## PostgreSQL unattended install
## Author: Stefan Prodan
## Date : 16 Oct 2014
## Company: VeriTech.io
################################################################################
Function Install-Postgres
{
@stefanprodan
stefanprodan / bulk-file-deletion.bat
Created April 16, 2015 20:02
Solution to delete millions of files on windows, after starting the script kill explorer.exe process. Script source http://superuser.com/a/892412/376959
@ECHO OFF
SETLOCAL EnableDelayedExpansion
IF /I "%~1"=="timestamp" (
CALL :ECHOTIMESTAMP
GOTO END
)
rem directory structure to delete
SET "DELETE=c:\_delete\???<<<change this>>>???"
@stefanprodan
stefanprodan / wsus.bat
Created April 28, 2015 10:58
Local vs MS WSUS switching, source http://serverfault.com/a/316476
@echo off
:START
cls
echo Temporary WSUS Script
echo ==============================
echo This script will flip between using the internal WSUS server and Microsoft's servers.
echo.
set /p WSUSSETTING=Type [W] to use WSUS or [C] to clear the setting and use MS servers:
IF /i (%WSUSSETTING%) == (W) goto CONTINUE
@stefanprodan
stefanprodan / goinstall.sh
Last active March 24, 2019 05:30
setup golang dev env for ubuntu desktop
#!/bin/bash
GVERSION="1.4.2"
GFILE="go$GVERSION.linux-amd64.tar.gz"
LVERSION="27.2.1"
LFILE="liteidex$LVERSION.linux-64-qt4.tar.bz2"
GOPATH="$HOME/go"
if [ -d "$HOME/.go" ]; then
echo "Installation directories already exist $HOME/.go $HOME/go"
exit 1
@stefanprodan
stefanprodan / rethinkdb-ubuntu14.md
Last active August 29, 2015 14:23
RethinkDB Ubuntu Trusty dev cluster setup

Install

source /etc/lsb-release && echo "deb http://download.rethinkdb.com/apt $DISTRIB_CODENAME main" | sudo tee /etc/apt/sources.list.d/rethinkdb.list
wget -qO- http://download.rethinkdb.com/apt/pubkey.gpg | sudo apt-key add -
sudo apt-get update
sudo apt-get install rethinkdb

Run as service

@stefanprodan
stefanprodan / Boxstarter.ps1
Last active August 29, 2015 14:27
Boxstarter script for DevLab project.
# NUC workstation setup
# VeriTech Solution @ 2015
# https://veritech.io/
# START http://boxstarter.org/package/nr/url?http://bit.ly/1IMTQcD
# enable reboot
$Boxstarter.RebootOk=$true
$Boxstarter.NoPassword=$false
$Boxstarter.AutoLogin=$true