Skip to content

Instantly share code, notes, and snippets.

View ckalegi's full-sized avatar

Cameron Kalegi ckalegi

View GitHub Profile
@ckalegi
ckalegi / lds-player-controls.js
Last active July 27, 2024 11:07
LDS Player Controls
/* LDS Player Controls - @ckalegi
* https://gist.github.com/ckalegi/f6a23b046af9bdb887a334df4c226a4b
*
* Preview tracks quicker by seeking through and marking for download with keyboard commands
*
* // USE:
* Open folder containing tracks
* Up/Down arrows - previous/next song
* Left/Right arrows - Seek forward/back 10 seconds (+CMD for 20 seconds)
* Space - Play/pause
@ckalegi
ckalegi / Code.gs
Last active April 15, 2020 06:24
Bare-bones dynamic, mass email via gmail
/**
* Sends emails with data from the current spreadsheet.
*
* sheet column names:
* A B C D
* email first_name url subject
*/
function sendEmails() {
var sheet = SpreadsheetApp.getActiveSheet();
// Export gCal events to gSheet
//
// Saves cal events between 2 dates to a sheet
// Calculates event duration by hour as a float (1hr 30m = 1.5)
// ** Open a google sheet > Tools > Script Editor > Paste this > Enter your own params > Save > Run
function exportGcal(){
// PARAMS
// ------
// myEmail : string
@ckalegi
ckalegi / antiAntiDebugger.js
Created October 19, 2018 14:04
Prevent obfuscated client side scripts from calling anonymous debugger functions
window.unsafeWindow || (
unsafeWindow = (function () {
var el = document.createElement('p');
el.setAttribute('onclick', 'return window;');
return el.onclick();
}())
);
(function () {
var _constructor = unsafeWindow.Function.prototype.constructor;
@ckalegi
ckalegi / gmailCalInvite-autoArchive.js
Created October 10, 2018 21:18
Auto-archive past Gcal Invitations - for use in google apps scripts
function findInvites(e) {
console.log('Starting Calendar Archive');
// Find all calendar invitations
var threads = GmailApp.search("has:attachment .ics in:inbox");
console.log('Found ' + threads.length + ' calendar invitations');
for (var threadCounter = 0; threadCounter < threads.length; threadCounter++) {
var messages = threads[threadCounter].getMessages();
// iterate through each invit
@ckalegi
ckalegi / spamiMessage.applescript
Last active July 2, 2018 21:25
Send the same iMessage N times to X recipient
on run
set promptTargetPhone to display dialog "Enter the iMessage phone number or email of target recipient" default answer ""
set targetPhone to text returned of promptTargetPhone
set promptTargetMessage to display dialog "Enter the message to send" default answer ""
set targetMessage to text returned of promptTargetMessage
set promptSendCount to display dialog "How many times should it send?" default answer ""
set sendCount to text returned of promptSendCount
repeat sendCount times
tell application "Messages"
set targetService to 1st service whose service type = iMessage
@ckalegi
ckalegi / IP + Location from command line
Last active June 22, 2018 17:03
IP + Location from terminal
save myip.py to ~/
add .bash_profile to ~/.bash_profile
#!/bin/bash
export DEBIAN_FRONTEND=noninteractive;
echo "[*] Starting Install... [*]"
echo "[*] Upgrade installed packages to latest [*]"
echo -e "\nRunning a package upgrade...\n"
apt-get -qq update && apt-get -qq dist-upgrade -y
apt full-upgrade -y
apt-get autoclean
echo "[*] Install stuff I use all the time [*]"
@ckalegi
ckalegi / zips.json
Created June 16, 2017 10:01
Zipcodes with lat/lng by State and City
This file has been truncated, but you can view the full file.
[
{"zip": "35004", "state": "AL", "latitude": " 33.606379", "longitude": " -86.50249", "city": "Moody", "fullState": "Alabama"},
{"zip": "35005", "state": "AL", "latitude": " 33.592585", "longitude": " -86.95969", "city": "Adamsville", "fullState": "Alabama"},
{"zip": "35006", "state": "AL", "latitude": " 33.451714", "longitude": " -87.23957", "city": "Adger", "fullState": "Alabama"},
{"zip": "35007", "state": "AL", "latitude": " 33.232422", "longitude": " -86.80871", "city": "Alabaster", "fullState": "Alabama"},
{"zip": "35010", "state": "AL", "latitude": " 32.903432", "longitude": " -85.92669", "city": "Alexander City", "fullState": "Alabama"},
{"zip": "35014", "state": "AL", "latitude": " 33.355960", "longitude": " -86.27720", "city": "Alpine", "fullState": "Alabama"},
{"zip": "35016", "state": "AL", "latitude": " 34.323715", "longitude": " -86.49278", "city": "Arab", "fullState": "Alabama"},
{"zip": "35019", "state": "AL", "latitude": " 34.292540", "longitude": " -86.63505", "city": "Baileyton", "fullStat