Skip to content

Instantly share code, notes, and snippets.

View 9ete's full-sized avatar
😃

Pete Lower 9ete

😃
View GitHub Profile
@9ete
9ete / toggleControlCenterNowPlaying.workflow
Created February 8, 2023 16:42
Toggle Control Center Now Playing - add to Alfred, KeyMaestro, or Shortcuts to run via HotKey
tell application "System Events"
tell process "Control Center"
if not (exists (group of window "Control Center")) then
click menu bar item "Now Playing" of menu bar 1
end if
if exists (button "play" of group of window "Control Center") then
click button "play" of group of window "Control Center"
else
click button "pause" of group of window "Control Center"
end if
@9ete
9ete / git-nuke.sh
Created March 4, 2022 19:46
Git Nuke - removes untracked and restores all unstaged
git config --global alias.nuke '!git clean -f && git restore .'
@9ete
9ete / better-git-checkout.sh
Created February 6, 2022 19:37
Gchk bash function to extend on git checkout
function gchk() {
if [[ $1 == "-h" ]]; then
echo "\nThis function will checkout the branch or prompt the user to create the branch of it does not exist"
return
fi
if [[ $1 == "-b" ]]; then
git checkout -b ${2}
return
@9ete
9ete / dynamic-mixin.scss
Last active December 14, 2021 19:23
Dynamic Sass/SCSS Mixin
// Why: reduce lines by grouping related styles (flexbox, background, etc)
// Creates short powerful style mixins see https://gist.github.com/hawkeye126/8328945e412fda9617d9a6a165632dd3
@mixin dynamicMixin($mixin-args: ()){
@each $rule, $value in $mixin-args {
#{$rule}: #{$value};
}
}
// use directly
@9ete
9ete / flexbox-mixin.scss
Last active December 14, 2021 19:23
Short Dynamic Flexbox Mixin, only pass in and account for what you need...
@mixin flex($flex-styles: ()) {
display: flex;
@each $flex-rule, $flex-value in $flex-styles {
#{$flex-rule}: #{$flex-value};
}
}
@9ete
9ete / debian_server_update.sh
Created March 20, 2021 21:09
LM Debian Server Updates 7 - 10
printf "\n\n Pre Update Work \n\n";
printf "Remove Mod Pagespeed";
# disable the working symlinked stuffs
a2dismod pagespeed;
service apache2 restart;
# turn off
mv /etc/apache2/mods-available/pagespeed.conf /etc/apache2/mods-available/pagespeed.conf.on
mv /etc/apache2/mods-available/pagespeed.conf.off /etc/apache2/mods-available/pagespeed.conf
# remove cloudflare apache module
@9ete
9ete / wordpress-check-remember-me-checkbox-by-default.php
Created April 4, 2018 21:52
WordPress action to check the login box 'remember me' checkbox by default without JavaScript
<?php
add_action( 'login_init', function(){$_POST['rememberme'] = 'remember';});
@9ete
9ete / pdn-about.html
Last active September 11, 2015 20:28
PDN About Us content w/o inline styles
<h3>Our goal is simple – to be the leading destination of high-quality, personal defense video content online and a no-nonsense gathering place for those serious about arming themselves for defense in every aspect of their lives.</h3>
<h2>The Beginning</h2>
<p>We found there was a need for high-quality personal defense instructional videos, so we searched out the top instructors in the field and produced the Personal Firearm Defense DVD Series. We partnered with Rob Pincus, a personal defense industry leader and owner of I.C.E. Training, to provide instruction on our DVDs as well as act as executive director for <a href="http://www.PersonalDefenseNetwork.com/" target="_blank">PersonalDefenseNetwork.com</a>.</p>
<h2>Who We Are</h2>
<p>Personal Defense Network (PDN) brings together the insight and training expertise of the best instructors in the industry, and has become the go-to resource for conscientious civilians, law enforcement personnel and military operators interested in defending every aspect of t
@9ete
9ete / wp-checkbox-setting.php
Created July 22, 2015 19:00
WordPress Checkbox Admin Setting Functions
<?php
// register setting
function ma_theme_init() {
register_setting( 'ma-settings-group', 'ma_show_setting' );
add_settings_section( 'ma_setting_section', 'MA Settings:', 'ma_setting_section_callback', 'wpsettings' );
add_settings_field( 'ma_setting_checkbox', 'CheckBox', 'ma_setting_checkbox_callback', 'wpsettings', $section = 'ma_setting_section');
}
add_action('admin_init', 'ma_theme_init');
@9ete
9ete / gist:4f06b2786fc8c93bd61c
Created May 8, 2015 22:12
Create database quickly
#!/bin/bash
BTICK='`'
EXPECTED_ARGS=3
E_BADARGS=65
MYSQL=`which mysql`
Q1="CREATE DATABASE IF NOT EXISTS ${BTICK}$1${BTICK};"
Q2="GRANT ALL ON ${BTICK}$1${BTICK}.* TO '$2'@'localhost' IDENTIFIED BY '$3';"
Q3="FLUSH PRIVILEGES;"