Skip to content

Instantly share code, notes, and snippets.

View vevedh's full-sized avatar
💭
containment

Hervé de CHAVIGNY vevedh

💭
containment
  • Martinique
  • 14:15 (UTC -04:00)
View GitHub Profile
@vevedh
vevedh / Convert-DirectoryToJson.ps1
Created April 15, 2021 11:25 — forked from janikvonrotz/Convert-DirectoryToJson.ps1
Convert-DirectoryToJson #PowerShell #JSON
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)
@vevedh
vevedh / Split-FileNamesByYearMonth.sh
Created April 15, 2021 11:16 — forked from janikvonrotz/Split-FileNamesByYearMonth.sh
Split file names into year and month folder
for file in *; do
echo $file;
yearmonth=$(echo $file | grep -o '[0-9][0-9][0-9][0-9]-[0-9][0-9]')
newfilename=$(echo $file | grep -o '[0-9][0-9]-[a-z].*.md$')
mkdir $yearmonth
mv $file $yearmonth/$newfilename
done
@vevedh
vevedh / wsl2-network.ps1
Created March 22, 2021 00:59 — forked from daehahn/wsl2-network.ps1
WSL 2 TCP NETWORK FORWARDING
# WSL2 network port forwarding script v1
# for enable script, 'Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser' in Powershell,
# for delete exist rules and ports use 'delete' as parameter, for show ports use 'list' as parameter.
# written by Daehyuk Ahn, Aug-1-2020
# Display all portproxy information
If ($Args[0] -eq "list") {
netsh interface portproxy show v4tov4;
exit;
}
@vevedh
vevedh / index.js
Last active February 26, 2021 21:16 — forked from zkat/index.js
npx is cool
#!/usr/bin/env node
var args = process.argv;
const os = require('os');
console.log('Système :',os.platform(), args[2])
# check if git is installed
hash git >/dev/null && /usr/bin/env git clone git://github.com/kaochenlong/eddie-vim.git ~/.vim || {
echo "sorry, git is not installed in this machine."
exit
}
@vevedh
vevedh / nodejs_installer.ps1
Created September 12, 2019 10:34 — forked from nweldev/nodejs_installer.ps1
Powershell script installing nodejs (with git) and some npm packages
write-host "`n ## NODEJS INSTALLER ## `n"
### CONFIGURATION
# nodejs
$version = "4.4.7-x64"
$url = "https://nodejs.org/dist/latest-v4.x/node-v$version.msi"
# git
$git_version = "2.9.2"
@vevedh
vevedh / InstallSerivice.ps1
Created August 13, 2019 11:11 — forked from pmolchanov/InstallSerivice.ps1
Install a service
$ServiceExe = "MyService.exe"
$ServiceName = "MyService"
$ServiceDisplayName = "MyService DisplayName"
$ServiceBinPath = [System.IO.Path]::GetFullPath($ServiceExe)
& sc.exe delete $ServiceName
& sc.exe create $ServiceName binPath= "`"$ServiceBinPath`"" DisplayName= "`"$ServiceDisplayName`""
& sc.exe start $ServiceName
@vevedh
vevedh / SilentSysinternalsInstall.ps1
Created August 13, 2019 11:09 — forked from pmolchanov/SilentSysinternalsInstall.ps1
Silent Sysinternals Install
&{
(New-Object System.Net.WebClient).DownloadFile(
"https://download.sysinternals.com/files/SysinternalsSuite.zip",
"$env:TEMP\SysinternalsSuite.zip")
$Shell = New-Object -com shell.application
$Zip = $Shell.NameSpace("$env:TEMP\SysinternalsSuite.zip")
New-Item -ItemType Directory -Force -Path "$env:ProgramFiles\SysinternalsSuite"
$Shell.Namespace("$env:ProgramFiles\SysinternalsSuite").CopyHere($Zip.Items())
[Environment]::SetEnvironmentVariable(
"Path",
@vevedh
vevedh / ImportSSLCert.ps1
Created August 13, 2019 11:08 — forked from pmolchanov/ImportSSLCert.ps1
Import SSL Certificate
&{
# Select PFX file dialog
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null
$OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog
$OpenFileDialog.Title = "Select SSL Certificate in PFX format"
$OpenFileDialog.Filter = "Personal Information Exchange (*.pfx)|*.pfx"
$OpenFileDialog.ShowDialog() | Out-Null
$PFXFile = $OpenFileDialog.FileName
# Get password dialog
@vevedh
vevedh / rPi3-ap-setup.sh
Created September 3, 2016 23:26 — forked from Lewiscowles1986/rPi3-ap-setup.sh
Raspberry Pi 3 access-point-setup
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Must be root"
exit
fi
if [[ $# -lt 1 ]];
then echo "You need to pass a password!"
echo "Usage:"