Skip to content

Instantly share code, notes, and snippets.

View mogrady-professional's full-sized avatar

Michael O'Grady mogrady-professional

View GitHub Profile
Add-Type -AssemblyName System.Windows.Forms
# Function to import user32.dll for mouse events
Add-Type @"
using System;
using System.Runtime.InteropServices;
public class MouseClicker {
[DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
public static extern void mouse_event(uint dwFlags, uint dx, uint dy, uint cButtons, uint dwExtraInfo);
public const int MOUSEEVENTF_LEFTDOWN = 0x02;
@mogrady-professional
mogrady-professional / move_cursor.ps1
Last active June 19, 2024 15:56
Run this script by opening PowerShell and typing: Set-ExecutionPolicy Bypass -Scope Process .\move_cursor.ps1
Add-Type -AssemblyName System.Windows.Forms
# Function to move the cursor
function Move-CursorInCircle {
param (
[int]$radius,
[int]$centerX,
[int]$centerY,
[int]$duration
)
import pyautogui
import time
import math
# Function to move the cursor in a circle
def move_cursor_in_circle(radius, center_x, center_y, duration):
# Calculate the number of steps for a smooth circle
steps = 360
step_duration = duration / steps
@mogrady-professional
mogrady-professional / .snyk
Last active August 16, 2024 12:11
Example Snyk file ignoring vulnerabilities
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
version: v1.25.0
# ignores vulnerabilities until expiry date; change duration by modifying expiry date
ignore:
SNYK-JS-ANSIREGEX-1583908:
- '*':
reason: Not affecting Snyk CLI. No upgrade path currently available
expires: 2022-02-01T00:00:00.000Z
created: 2021-11-29T17:25:19.200Z
SNYK-JS-LODASHSET-1320032:
@mogrady-professional
mogrady-professional / style.css
Last active September 1, 2023 19:11
Most common breakpoints for Media Queries
@media (min-width: 1200px) {
body {
background-color: red;
}
}
@media (min-width: 992px) and (max-width: 1199px) {
body {
background-color: green;
}
@mogrady-professional
mogrady-professional / node_nginx_ssl.md
Created November 3, 2022 11:28
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

@mogrady-professional
mogrady-professional / gh-pages-deploy.md
Created September 18, 2022 15:13 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@mogrady-professional
mogrady-professional / SendDynamic.py
Last active April 22, 2022 20:27
Sendgrid — Dynamic Email Template aka Transactional Templates— Python Django
# https://www.twilio.com/blog/send-dynamic-emails-python-twilio-sendgrid
#!/usr/bin/env python3
import os
from sendgrid.helpers.mail import Mail
from sendgrid import SendGridAPIClient
# from address we pass to our Mail object, edit with your name
FROM_EMAIL = '[email protected]'
# update to your dynamic template id from the UI
@mogrady-professional
mogrady-professional / Directory-Structure-Schemas.md
Last active June 9, 2022 18:28
Directory Structure Schemas for README.md's

React

React_App
├── node_modules
|   └── ...
├── public
│   ├── favicon.ico
│   ├── index.html
│   ├── logo192.png
@mogrady-professional
mogrady-professional / console.assert.example1.js
Created February 28, 2022 20:32
console.assert() example 1
const errorMsg = 'the # is not even';
for (let number = 2; number <= 5; number += 1) {
console.log('the # is ' + number);
console.assert(number % 2 === 0, {number: number, errorMsg: errorMsg});
// or, using ES2015 object property shorthand:
// console.assert(number % 2 === 0, {number, errorMsg});
}
// output:
// the # is 2
// the # is 3