Skip to content

Instantly share code, notes, and snippets.

View stringsn88keys's full-sized avatar

Thomas Powell stringsn88keys

View GitHub Profile
@stringsn88keys
stringsn88keys / to_powershell.md
Last active April 26, 2024 21:02
convert cmd or bash to powershell
command from powershell powershell abbreviated
rmdir /q /s c:\folder cmd.exe Remove-Item -Recurse -Force c:\folder rm -r -fo c:\folder
find . -name '*wildcard*' bash Get-ChildItem -Path . -Include '*wildcard*' gci . -inc '*wildcard*'
ls -lart bash Get-ChildItem | Sort-Object LastWriteTime ls | sort LastWriteTime
dir /o:d cmd.exe Get-ChildItem | Sort-Object LastWriteTime ls | sort LastWriteTime
ls -larS bash Get-ChildItem | Sort-Object Length ls | sort Length
dir /o:s cmd.exe Get-ChildItem | Sort-Object Length ls | sort Length
@stringsn88keys
stringsn88keys / openssl_stats.rb
Last active April 17, 2024 16:44
OpenSSL ruby constants and settings dump
require 'openssl'
# https://ruby.github.io/openssl/OpenSSL.html
puts "OpenSSL::OPENSSL_FIPS = #{OpenSSL::OPENSSL_FIPS}"
puts "\t-> Boolean indicating whether OpenSSL is FIPS-capable or not"
# try to turn on fips_mode if it is marked as true
if OpenSSL::OPENSSL_FIPS
puts "-> Setting fips_mode to true"
// Inspired by https://www.youtube.com/watch?v=MHBG_R_dhwk
#include <stdio.h>
int main() {
char input_line[80];
long line_count = 0;
while(!feof(stdin)) {
fgets(input_line, 80, stdin);
if(!feof(stdin)) line_count++;
@stringsn88keys
stringsn88keys / generate_key_check.rb
Created November 28, 2022 21:57
Test generate_key
require 'openssl'
curve='prime256v1'
p ::OpenSSL::PKey::EC.new(curve).generate_key
@stringsn88keys
stringsn88keys / send_message.applescript
Created September 16, 2022 16:30
Send an iMessage from the command line (one arg at a time)
#!/usr/bin/env osascript
# https://chrispennington.blog/blog/send-imessage-with-applescript/
on run parameters
# the number here is the number of seconds
set theDelay to 3
# Verify if this can use display names
set phoneNumber to "+1 (555) 555-1212"
tell application "Messages"
set targetBuddy to phoneNumber
@stringsn88keys
stringsn88keys / bundle_info_all
Last active August 31, 2022 13:26
bundle info for all gems
bundle list 2>&1 | sed 's/^ \* \(.*\) (.*)/\1/' | grep -v 'bundle info' | grep -v 'bundle:' | xargs -I {} bundle info {}
@stringsn88keys
stringsn88keys / keep_alive_and_window_mover.ino
Last active April 28, 2022 23:58
Arduino LCD Keypad hotkey example which moves windows
#include <Keyboard.h>
#include <Mouse.h>
#include <LiquidCrystal.h>
/*
Arduino 2x16 LCD - Detect Buttons
modified on 18 Feb 2019
by Saeed Hosseini @ Electropeak
https://electropeak.com/learn/
@stringsn88keys
stringsn88keys / keep_alive_with_led_reset_blink.ino
Created April 26, 2022 23:01
Arduino mouse mover to keep PC awake
@stringsn88keys
stringsn88keys / convert_times
Last active April 22, 2022 15:33
Ruby script to display time zone equivalents for a given time
#!/usr/bin/env ruby
require 'time'
require 'tzinfo'
require 'colorize'
def usage
puts %q(
usage:
convert_times {time string to parse, spaces ok}
@stringsn88keys
stringsn88keys / parse_pipedelimited.sql
Created March 1, 2022 18:35
MySQL to parse multiline pipe delimited strings into returned rows
<!-- wp:code -->
<pre class="wp-block-code"><code>
select list.i,
substring_index(substring_index(
substring_index(
substring_index(
'9977034 | e9e82737-db8f-44c0-985b-d004788aa91d | 208
3393402 | aa1cbfe0-a66d-44ac-9b66-bd2369c96e52 | 136
3524174 | 490dbaa0-faed-4773-b3c0-4c979e1b07cb | 250