Skip to content

Instantly share code, notes, and snippets.

Avatar

Janik Vonrotz janikvonrotz

View GitHub Profile
@janikvonrotz
janikvonrotz / Get-RandomPassword.ps1
Last active Mar 13, 2017
PowerShell: Get Random Password #PowerShell
View Get-RandomPassword.ps1
function Get-RandomPassword{
$numbers = 1..9
$consonants = "b","c","d","f","g","h","k","l","m","n","p","r","s","t","v","w","x","z"
$nopeletters = "j","q","y"
$vocals = "a","e","i","o","u"
$dotsandstuff = ",",".","-"
$nopedotsandstuff = ";",":","_"
return (Get-Random $consonants).ToString().ToUpper() +
@janikvonrotz
janikvonrotz / Restore-DuplicityFileExample.sh
Last active Aug 29, 2015
Ubuntu: Restore Duplicity File Example #Ubuntu #Duplicity
View Restore-DuplicityFileExample.sh
sudo /usr/local/src/duplicity-backup/duplicity-backup.sh -c /etc/duplicity-backup/duplicity-backup.conf --restore-file etc/nginx/conf.d/sebastianvonrotz.ch.conf ~/sebastianvonrotz.ch.conf -t 2015-08-17
sudo /usr/local/src/duplicity-backup/duplicity-backup.sh -c /etc/duplicity-backup/duplicity-backup.conf --list-current-files -t 2015-08-17
@janikvonrotz
janikvonrotz / Install Koken website.md
Last active Aug 31, 2015
Ubuntu: Install Koken website #Koken #Markdown
View Install Koken website.md
@janikvonrotz
janikvonrotz / Compare-ADUserGroupMembership.ps1
Last active Apr 13, 2019
Compare-ADUserGroupMembership #PowerShell #AcitveDirectory
View Compare-ADUserGroupMembership.ps1
Import-Module ActiveDirectory
$user1 = "userRef"
$user2 = "userDif"
$members1 = Get-ADPrincipalGroupMembership -Identity $user1 | Select-Object name
$members2 = Get-ADPrincipalGroupMembership -Identity $user2 | Select-Object name
$result = Compare-Object -ReferenceObject $members1 -DifferenceObject $members2 -Property name
@janikvonrotz
janikvonrotz / Convert-DirectoryToJson.ps1
Last active Sep 22, 2019
Convert-DirectoryToJson #PowerShell #JSON
View Convert-DirectoryToJson.ps1
function Get-RandomHexString {
param($count)
$hex = '012345679ABCDEF'.ToCharArray()
$array = foreach($number in 1..$count ){ $hex | Get-Random}
return (($array) -join "").ToString().ToLower()
}
function Get-WikiType{
param($file)
@janikvonrotz
janikvonrotz / Generate CSR (Certificate Signing Request) with OpenSSL.md
Created Jul 25, 2015
Generate CSR (Certificate Signing Request) with OpenSSL #OpenSSL #Markdown
View Generate CSR (Certificate Signing Request) with OpenSSL.md

Define the following attributes, you have to set them in the wizard when generating the CSR.

  • Common Name (the domain name certificate should be issued for)
  • Country
  • State (or province)
  • Locality (or city)
  • Organization
  • Organizational Unit (Department)
  • E-mail address
@janikvonrotz
janikvonrotz / Install Lets Encrypt and create a free SSL certificate.md
Last active Jul 22, 2020
Install Let's Encrypt and create a free SSL certificate #OpenSSL #Markdown
View Install Lets Encrypt and create a free SSL certificate.md

Introduction

Let’s Encrypt is a free, automated, and open certificate authority (CA), run for the public’s benefit. Let’s Encrypt is a service provided by the Internet Security Research Group (ISRG). This guide shows you how you can obtain a free SSL certificate.

Requirements

@janikvonrotz
janikvonrotz / SQL Cheat Sheet.md
Last active Oct 13, 2020
SQL Cheat Sheet#SQL#Markdown
View SQL Cheat Sheet.md

SQL languages

DDL is short name of Data Definition Language, which deals with database schemas and descriptions, of how the data should reside in the database.

DML is short name of Data Manipulation Language which deals with data manipulation, and includes most common SQL statements such SELECT, INSERT, UPDATE, DELETE etc, and it is used to store, modify, retrieve, delete and update data in database.

DCL is short name of Data Control Language which includes commands such as GRANT, and mostly concerned with rights, permissions and other controls of the database system.

Datatypes

Text types

@janikvonrotz
janikvonrotz / Enable-PowerShellISEWindowsServer.ps1
Last active Aug 29, 2015
Enable PowerShell ISE for Windows Server #PowerShell #WindowsServer
View Enable-PowerShellISEWindowsServer.ps1
Import-Module ServerManager
Add-WindowsFeature PowerShell-ISE
@janikvonrotz
janikvonrotz / map.geojson
Last active Jan 4, 2018
Places I've been to #JanikVonrotz
View map.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
You can’t perform that action at this time.