Skip to content

Instantly share code, notes, and snippets.

@startuml
'''' Declarations for title, caption, etc ''''
'''' Declarations to stylize the diagram ''''
hide circle
@tylerlmz1
tylerlmz1 / extractLine.ps1
Created April 7, 2020 22:04
extract specified line range from a text file to a new text file
# get source and destination file name
$fileName = Read-Host -Prompt 'Source file name'
$content = Get-Content $fileName
$newFileName = Read-Host -Prompt 'New file name'
# get line number
$start = Read-Host -Prompt 'Starting line number'
$end = Read-Host -Prompt 'Ending line number'
@tylerlmz1
tylerlmz1 / RussianPeasantAlgorithm.js
Created April 7, 2020 03:30
Russian peasant algorithm written in Node.js
const assert = require('assert').strict
function russianPeasantAlgo(a, b) {
aArray = []
bArray = []
// process first number
while (a > 0.99) {
aArray.push(a)
a = Math.trunc(a / 2)
@tylerlmz1
tylerlmz1 / pasteCurrentTime.sh
Created November 17, 2019 09:46
paste current time into active window, works in linux
dateString=$(date +"%Y-%m-%d")
timeString=$(date +"%H:%M:%S")
content="-- [ $dateString ] [ $timeString ] --"
# Preserve the current value of the clipboard
clipboard=$(xsel -b -o)
# Put text in primary buffer for Shift+Insert pasting
echo -n "$content" | xsel -p -i
@tylerlmz1
tylerlmz1 / snoit.ps1
Created June 4, 2019 09:15
Search and open folders in Typora (with powershell)
#snoit.ps1
#snoit stands for 'search n open in typora'
#### For Linux
# $typora_path = 'typora'
#### For Windows
$typora_path = 'C:\Program Files\Typora\typora.exe'
@tylerlmz1
tylerlmz1 / PowershellAes.ps1
Created May 19, 2019 09:12 — forked from ctigeek/PowershellAes.ps1
Aes Encryption using powershell.
function Create-AesManagedObject($key, $IV) {
$aesManaged = New-Object "System.Security.Cryptography.AesManaged"
$aesManaged.Mode = [System.Security.Cryptography.CipherMode]::CBC
$aesManaged.Padding = [System.Security.Cryptography.PaddingMode]::Zeros
$aesManaged.BlockSize = 128
$aesManaged.KeySize = 256
if ($IV) {
if ($IV.getType().Name -eq "String") {
$aesManaged.IV = [System.Convert]::FromBase64String($IV)
}