Skip to content

Instantly share code, notes, and snippets.

@henno
henno / openbravo_pos_sales_clearing_script.sql
Created June 9, 2016 16:49
Delete sales from Openbravo POS
delete from ticketlines;
delete from ticketlines;
delete from tickets;
delete from taxlines;
delete from payments;
delete from stockdiary;
delete from stockcurrent;
delete from reservation_customers;
delete from reservations;
delete from receipts;
@henno
henno / projects.example.com.conf
Last active November 12, 2016 21:38
Nginx configuration for projects as subdirectories (projects.example.com/project1)
#
# cat /etc/nginx/sites-enabled/projects.example.com
#
# Define variable $topdir (top level directory name)
map $request_uri $topdir {
~(?<captured_topdir>^/[a-zA-Z0-9]+)[/] $captured_topdir;
}
server {
@henno
henno / forward_remote_server_port_to_local_port.sh
Last active November 27, 2016 12:49
Forward remote web server port 9000 to localhost using SSH for debugging code running on remote server
#!/bin/sh
# Execute this on your local development machine
ssh -R 9000:localhost:9000 virt50123@mylivesite.com
@henno
henno / import_users.ps1
Created December 22, 2016 18:23
Load users to Active Directory from CSV
$Users = Import-Csv -Delimiter ";" -Path "C:\Users\Administrator\Desktop\users.csv"
foreach ($User in $Users)
{
$Displayname = $User.'Firstname' + " " + $User.'Lastname'
$UserFirstname = $User.'Firstname'
$UserLastname = $User.'Lastname'
$OU = $User.'OU'
$SAM = $User.'SAM'
$UPN = $User.'Firstname' + "." + $User.'Lastname' + "@" + $User.'Maildomain'
$Password = $User.'Password'
@henno
henno / SSTP_VPN_certificate_renewal.md
Created May 2, 2017 18:23
SSTP VPN certificate renewal
  1. Export new (renewed) Let's Encrypt certificate from \Certificates (Local Computer)\Web Hosting\Certificates to a file
  2. Import the certificate from file to \Certificates (Local Computer)\Personal
  3. Execute C:\> netsh http show sslcert and copy the certificate hash of the binding that uses a certificate from WebHosting store
  4. Execute C:\>Netsh ras set sstp-ssl-cert hash=xxxxxxxxxxxxxxx
  5. Restart RRAS service
http://www.catalog.update.microsoft.com/search.aspx?q=kb2952664
@henno
henno / refresh_database.sh
Last active January 12, 2020 09:57
Bash (for example git-bash.exe) version
#!/usr/bin/env bash
# This file can do one of two things:
# - reset a MySQL database back to original state from a dump file at given location and
# - create a new dump file from the current contents of given MySQL database
#
# Usage for resetting a database from dump:
#
# refresh_database.sh yourdatabasename
#
#
@henno
henno / mikrotik_base_conf.rsc .ini
Last active May 21, 2019 08:00
Mikrotik base config
# Mikrotik config derived from the default factory config
# Features:
# - Ether1 is for Internet (WAN) and has DHCP client enabled
# - Ether 2-5 and wlan1 and wlan2 are in a bridge called bridge
# - This bridge has a DHCP server activated serving IPs from $myLanSubnet.10-$myLanSubnet.254
# - Wireless is set up with $mySSID using WPA2 and Sinimustvalge
# - Custom admin user tvv with klaabu is set to protect against hacking
# - Get an email when a user breaks the Internet by connecting his router's WAN port to your LAN
#
@henno
henno / xdebug settings php.ini
Created June 20, 2019 06:53
xdebug settings php.ini
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_autostart=1
; with sane limits
xdebug.var_display_max_depth = 10
xdebug.var_display_max_children = 512
xdebug.var_display_max_data = 1024
@henno
henno / refresh_database.bat
Last active January 12, 2020 09:57
Command Prompt (cmd.exe) version
@echo off
SET DUMP_FILE_LOCATION=doc\database.sql
SET MYSQL=c:\xampp\mysql\bin\mysql.exe
SET MYSQLDUMP=c:\xampp\mysql\bin\mysqldump.exe
IF "%1"=="" GOTO ERROR
SET DATABASE_NAME="%1"
IF "%2"=="--dump" GOTO :DUMP