Skip to content

Instantly share code, notes, and snippets.

View iamstev's full-sized avatar

Steven Smith iamstev

  • Stev Co
  • Royal Oak, MI
View GitHub Profile
@iamstev
iamstev / gist:f4b445cf5190a12a81e9ef831b0c448e
Created October 21, 2018 21:22
Enable/Disable Dark Mode hotkey
sudo defaults write /Library/Preferences/.GlobalPreferences.plist _HIEnableThemeSwitchHotKey -bool true
sudo defaults write /Library/Preferences/.GlobalPreferences.plist _HIEnableThemeSwitchHotKey -bool false

Keybase proof

I hereby claim:

  • I am iamstev on github.
  • I am stev (https://keybase.io/stev) on keybase.
  • I have a public key ASBRcPzti8HXl0RmU83w43J_9Dok5IEFibOV_CB9EyRgigo

To claim this, I am signing this object:

@iamstev
iamstev / homebridge
Last active July 1, 2017 12:01 — forked from johannrichard/homebridge
Systemd Service for homebridge (http://github.com/nfarina/homebridge)
# Defaults / Configuration options for homebridge
# The following settings tells homebridge where to find the config.json file and where to persist the data (i.e. pairing and others)
HOMEBRIDGE_OPTS=-U /var/homebridge
# If you uncomment the following line, homebridge will log more
# You can display this via systemd's journalctl: journalctl -f -u homebridge
# DEBUG=*
require_once('classes/ElasticEmail.class.php');
$ee = new stev_eemail($apikey['elastic']['key'], $apikey['elastic']['cert']);
$ee->params = array(
'to' => '',
'lists' => '',
'from' => '',
'from_name' => '',
// create user object
$user = new phnx_user;
// check user login status
$user->checklogin(1);
// check user subscription status
$user->checksub();
<?php
ob_start();
/* ROOT SETTINGS */ require($_SERVER['DOCUMENT_ROOT'].'/root_settings.php');
/* FORCE HTTPS FOR THIS PAGE */ forcehttps($use_https);
/* WHICH DATABASES DO WE NEED */
$db2use = array(
'db_auth' => TRUE,
@iamstev
iamstev / del_logs.php
Created December 8, 2015 15:14
Delete old logs from cron jobs
// THIS REQUIRES THAT LOGS BE STORED IN THE FOLLOWING FORMAT
// log-0000000000.0000.html
// As generated by:
// '/LOG_DIRECTORY/log-'.microtime(true).'.html';
/* DELETE LOGS OLDER THAN */
function del_logs($dir, $days){
$daysago = time() - ($days * 86400);
@iamstev
iamstev / db1.php
Last active June 20, 2016 20:33
Function to get a single value from a database with mysqli
<?php
/* DB1 FUNCTION (mysqli) */
// $params is an array that can be used to bind if the query needs to accept user input.
class DB1VerboseException extends Exception{}
function db1($database = NULL, $q = NULL, $verbose = FALSE, $params = NULL){
try{
if($q == NULL || $q == ''){
throw new Exception('DB1 Error: No query sent (DB1x01.1)');
print'<pre style="font-family:monospace;background-color:#444;padding:1em;color:white;">';var_dump();print'</pre>';
<?php
ob_start();
// do all the stuff from other pages, like connect to database and check for login etc.
// remember to handle no being logged in somehow, including closing the database connects and calling ob_end_flush();
// you should rename these variables to make sense for whatever you are doing