Skip to content

Instantly share code, notes, and snippets.

View patrickserrano's full-sized avatar
🔉

Patrick Serrano patrickserrano

🔉
View GitHub Profile
@patrickserrano
patrickserrano / terminal-commands.txt
Last active September 24, 2020 17:25
Scratch pad to keep useful terminal commands
// Keep mac awake until app is idle
caffeinate -i open -W -a iMovie.app
// Show hidden files (FALSE to hide)
defaults write com.apple.finder AppleShowAllFiles TRUE
// Create textfile of directory and all sub-directories (use .csv to maked a CSV)
ls -R /DIRECTORY > file-name.txt
// Find the PID running on port 3000
@patrickserrano
patrickserrano / dotfiles
Last active May 5, 2023 11:52
Default Writes for OSX
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until `.osx` has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
###############################################################################
# General UI/UX #
###############################################################################
@patrickserrano
patrickserrano / sequential-email-loop.rb
Created August 4, 2014 17:42
Quick Ruby for loop to print 500 sequential email addresses
for i in 1...501
puts "example#{i}@example.com"
end
@patrickserrano
patrickserrano / dinopass.rb
Last active May 4, 2016 14:13
Quick Ruby script for pulling passwords from Dinopass API
# script to pull 50 passwords into a CSV
# Requires 'curb' Ruby Gem ($ gem install curb)
# Pipe into CSV file for easy copy and paste!
# To run:
# cd to directory where file is stored
# $ Ruby dinopass.rb > passwords.csv
require 'curb'
for i in 0...50
@patrickserrano
patrickserrano / toStr.py
Created August 7, 2017 18:37
Python script to take input broken by new lines and returns as a comma separated string with each element wrapped in double quotes.
import subprocess
buffer = ''
while True:
line = input()
if not line: break
buffer += '"' + line + '",'
cmd = 'echo '+buffer[:-1].strip()+'|clip'
#!/usr/bin/env bash
# usage: ./split.sh <FILE> <LINES>
FILE_PATH="$1"
FILE_BASENAME="${FILE_PATH##*/}"
FILE_NAME="${FILE_BASENAME%%.*}"
FILE_EXTENSION="${FILE_BASENAME#*.}"
SPLIT_LINES=${$2:-500000}
-- See connections with status
select
c.session_id,
c.net_transport,
c.encrypt_option,
s.status,
c.auth_scheme,
s.host_name,
s.program_name,
s.client_interface_name,
@patrickserrano
patrickserrano / keychron_q3.json
Created November 28, 2022 23:35
Custom Keychron Q3 Keymap
{
"name": "Keychron Q3",
"vendorProductId": 875823393,
"macros": [
"{KC_LGUI,KC_LSFT,KC_A}",
"{KC_LGUI,KC_LSFT,KC_LALT,KC_LCTL,KC_PGUP}",
"{KC_LGUI,KC_LSFT,KC_LALT,KC_LCTL,KC_PGDN}",
"",
"",
"",