qwertycody
qwertycody
huehuehue
107 posts
you're gonna have a bad time
Don't wanna be here? Send us removal request.
qwertycody · 2 years ago
Text
GitHub Actions - Job to Copy a Workflow From One Repository to Another
Managing 30+ code repositories suddenly becomes less time consuming! :)
This is a continuation of what I posted the other day. In this exercise – I needed to be able to automatically copy workflow files from one repository to another. There is this known reported issue that despite adding a GitHub Actions Workflow file – unless it’s on the main/master branch – you can’t use the workflow_dispatch popup on the UI so build can be manually triggered (if needed). So I…
View On WordPress
1 note · View note
qwertycody · 2 years ago
Text
GitHub CLI - Programmatically Disabling and Enabling Branch Protection Rules
Documentation for the GitHub API was not as straightforward as I would like :)
Today I needed to be able to automatically disable and enable branch protection rules on a GitHub repository so that an Actions Build Template could be added to the main/master branch. There is this known reported issue that despite adding a GitHub Actions Workflow file – unless it’s on the main/master branch – you can’t use the workflow_dispatch popup on the UI so build can be manually…
View On WordPress
0 notes
qwertycody · 2 years ago
Text
MariaDB - Creating an Event and Procedure
Taking some time today to share a simple example of how to create an Event and a Stored Procedure in MariaDB. Use Case / Benefits: Executes an Stored Procedure on a set schedule (like a cronjob) Using a Stored Procedure in conjunction with an event allows you to change the code associated with the procedure without having to recreate the Event if something needs to be added Example – Stored…
View On WordPress
4 notes · View notes
qwertycody · 3 years ago
Text
PowerShell Script - Fixing DNS Resolution with WSL Ubuntu for While Connected to Anyconnect VPN
If you use WSL and work in a corporate environment that uses AnyConnect VPN - check out this automation I wrote up to help fix pains with DNS resolution.
Had this odd issue over the past week that I’d been trying to figure out once connected to company VPN via Cisco AnyConnect. This annoyed me enough that I wrote up a PowerShell Script to automatically handle the mode switching when on and off VPN. Symptoms: Curl didn’t work Ping didn’t work There were loads of solutions online but this one worked the best for me and required no modification…
View On WordPress
1 note · View note
qwertycody · 3 years ago
Text
Meeting Reminder Blackout - Now in Powershell!
Do you habitually snooze reminder alarms and need something more aggressive? Check out this Reminder Blackout Tool that I wrote in PowerShell!
If you follow this blog you may remember a post a long while back about my “Meeting Reminder Ball” that furiously bounces around the screen – and it’s sequel, a “Meeting Reminder Blackout” that gets rid of the ball concept and displays a reminder blackout on all screens. Well, I took a new job recently and have stepped back into a position where I have limited administrative positions on my…
Tumblr media
View On WordPress
0 notes
qwertycody · 3 years ago
Text
Enabling Hyper-V Services for Ubuntu to allow for Native SSH over WINDOWS 10/11 Networking SOCKS
Have you ever needed to SSH into a local virtual machine while Cisco AnyConnect was redirecting all networking traffic? Check this solution out!
Today I had the need to be able to connect to my Ubuntu VM on Hyper-V without having to specify the randomly generated IP address and also be able to continue to use it for development while Cisco AnyConnect was redirecting all traffic for my computer. I happened across a pretty great command called “hvc.exe” that can be used in Powershell which allows you to interact with a Virtual Machine…
View On WordPress
0 notes
qwertycody · 3 years ago
Text
Bash/Powershell - Killing an SSH Tunnel Running on a Specific Port
Have you ever used Git Bash / Cygwin to execute Powershell Commands on Windows? Check this out!
On Windows – I use Git Bash and my custom bash profile to create “quality of life” commands for various use cases. https://github.com/qwertycody/Bash_Environment/ Today I had need to be able to kill an SSH Tunnel Process running on a specific port. What made this tricky is that I needed to be able to use Powershell Commands via Git Bash (which I know is excessive, but I like things the way I…
View On WordPress
0 notes
qwertycody · 3 years ago
Text
Windows Server - File Cleanup Script for Task Scheduler - Delete Files Older Than X Days
Windows Server – File Cleanup Script for Task Scheduler – Delete Files Older Than X Days
Every time I’ve written this script I never save it and have to end up googling it again to tweak behavior to the way I want. So today I’m writing it down permanently! Side Note – It’s funny how it always ends up being on some piece of legacy infrastructure I’ve inherited running Windows Server 2012 or 2008 no matter what job position I’ve been in. This recurses into the subdirectories and…
Tumblr media
View On WordPress
0 notes
qwertycody · 3 years ago
Text
PHP - Check If File Age In Minutes and Perform Action
PHP – Check If File Age In Minutes and Perform Action
Had a need for this logic today – wrote up this snippet. if(file_exists($filePath)) { $lastEdit = filemtime($filePath); $lastEditReadable = gmdate('r', $lastEdit); $currentTime = time(); $currentTimeReadable = gmdate('r', $currentTime); $ageOfFileInSeconds = $currentTime - $lastEdit; $ageOfFileInMinutes = $ageOfFileInSeconds / 60; if($ageOfFileInMinutes < 10) { // Do Thing } }
View On WordPress
0 notes
qwertycody · 3 years ago
Text
Bash - Single Line STDIN String Loop Concatenation
Bash – Single Line STDIN String Loop Concatenation
I needed to create a ton of commands today for the GitHub Bot integration for Slack. Essentially what it boiled down to is string concatenation from STDIN outputting what was in my Repository directory in conjunction with the bot command. Result is below: find -d -maxdepth 1 | sed 's/\.\///g' | sort | while read repository; do echo "/github subscribe getbenjamin/$repository pulls releases";…
View On WordPress
0 notes
qwertycody · 3 years ago
Text
Python Script to Identify IP Ranges for EC2 Instance Connect
Python Script to Identify IP Ranges for EC2 Instance Connect
Today I needed to identify what IP ranges need to be added in security groups that allow EC2 Instance Connect to be able to establish a connection to a node. I absolutely did not want to open port 22 to the entire internet for obvious security reasons. As such, I found after reading through AWS docs that they maintain a JSON list that can be periodically parsed in the event they…
Tumblr media
View On WordPress
0 notes
qwertycody · 4 years ago
Text
Manually Truncating Docker Logs
Manually Truncating Docker Logs
Over the past couple weeks I’ve been redesigning my office and one thing I wanted to do once finishing is make sure my home server is still up and operational. I came to find out that it ran out of disk space so processes weren’t starting and naturally the only thing I was able to do is SSH into a zero percent disk space environment. It took me a while to find out exactly what the issue was but…
Tumblr media
View On WordPress
0 notes
qwertycody · 4 years ago
Text
Onedrive Hourly Refresh Utility for syncing large quantites of files
Need to Sync a ridiculous amount of data and OneDrive is freezing up on you? I wrote this utility that restarts OneDrive every hour and fixes this problem. Check it out! :)
I am nearing the last day with my current job at FINEOS Corporation and transitioning into my new role at Benjamin in the coming weeks. With my impending departure, I am making major efforts to offload >300GB worth of client data located in my FINEOS Office 365 OneDrive. This data is from the various obligations worked in the past three years – so it covers quite a bit of consulting work done…
View On WordPress
0 notes
qwertycody · 4 years ago
Text
Bash Automation Script for Targeted Code Analysis
Bash Automation Script for Targeted Code Analysis
This is a restructure of the script I wrote the other day called “Bash Automation Script to Clone and Bulk Modify Files for Commit” In this version of the script I am using it for something of an impact analysis to help identify all potential filenames that match a potential Jira ID so I can write a patch for work that I’m doing that will effectively reverse the changes. This is helpful for…
View On WordPress
0 notes
qwertycody · 4 years ago
Text
Bash Automation Script to Clone and Bulk Modify Files for Commit
Bash Automation Script to Clone and Bulk Modify Files for Commit
I have this habit of writing scripts for simple but repetitive tasks. Most of the time, I do this because I’m afraid of introducing a certain degree of human error depending on how many files I’m modifying. In this case, the scripts purpose was to modify many environmental files at a time and insert the same properties into each file if they matched whitelist conditions – and that is what the…
View On WordPress
0 notes
qwertycody · 4 years ago
Text
Declaring a Populated HashMap in JavaScript
Declaring a Populated HashMap in JavaScript
I was looking for a way to define a pre-populated HashMap today in JavaScript for a custom Chrome Extension I’m writing. Personally I’ve never liked the syntax of “define the array” and “add items to it one-at-a-time” Took me a bit to find some examples but in the process I found some great documentation from developers across the web – below are their examples – please go check their content…
View On WordPress
0 notes
qwertycody · 4 years ago
Text
AWS Log Insights - Replace Expression Generator Using Bash
AWS Log Insights – Replace Expression Generator Using Bash
I drafted this quick script up to support the query logic I wrote up yesterday. This also serves as a good baseline example for doing a for-loop over a string array, string comparison using if statements, and also checking the length of a string. declare -a…
Tumblr media
View On WordPress
0 notes