Skip to content

Instantly share code, notes, and snippets.

Avatar
Coffee.

Aubrey Taylor aubricus

Coffee.
View GitHub Profile
@aubricus
aubricus / License
Last active Nov 5, 2021
Python Progress Bar
View License
Copyright 2020 Aubrey Taylor
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTH
@aubricus
aubricus / create-new-file.ahk
Created Aug 16, 2011
AutoHotkey script to create a new file.
View create-new-file.ahk
; create new file
; installation:
; 1. you must be running autohotkey: http://www.autohotkey.com
; 2. double click on script to run
; [pro-tip] add this script to your startup folder to run when windows start
; [pro-top] you can add this script to another .ahk script file.
; hotkey is set to control + alt + n
; more on hotkeys: http://www.autohotkey.com/docs/Hotkeys.htm
@aubricus
aubricus / __init__.py
Last active Mar 4, 2020 — forked from yuvadm/fabfile.py
Using Fabric to connect to the remote server via an ssh config.
View __init__.py
from fabric.api import env
env.use_ssh_config = True
env.forward_agent = True
env.roledefs = {
# key # hostname from config
'foo': ['foo.production'],
}
@aubricus
aubricus / pyenv-mojave.sh
Last active Jan 29, 2019 — forked from excenter/rune.bash
Mojave pyenv update
View pyenv-mojave.sh
export LDFLAGS="-L/usr/local/opt/sqlite/lib -L/usr/local/opt/zlib/lib"
export CPPFLAGS="-I/usr/local/opt/sqlite/include -I/usr/local/opt/zlib/include"
xcode-select --install
brew update
brew upgrade
brew install zlib
pyenv install 3.7.1
pyenv global 3.7.1
@aubricus
aubricus / put-inside-functions.php
Created Nov 20, 2018 — forked from gilzow/put-inside-functions.php
Removes user endpoints from WordPress REST API
View put-inside-functions.php
<?php
/**
* Remove API Endpoints
*
* Clobber API routes to remove them from public access.
*/
function remove_wp_json_api_endpoints($endpoints) {
$toRemove = array(
"/oembed/1.0/embed",
"/wp/v2/users",
@aubricus
aubricus / setup_snippet.py
Created Feb 24, 2014
Use pandoc to convert README.md into .rst for Pypi
View setup_snippet.py
long_description = ''
try:
import subprocess
import pandoc
process = subprocess.Popen(
['which pandoc'],
shell=True,
stdout=subprocess.PIPE,
@aubricus
aubricus / 01_common.js
Last active Jan 11, 2018
Load Greensock TweenLite and TimelineLite with Require.js
View 01_common.js
require.config({
baseUrl: '/js',
/* non-essential config removed for berevity */
packages: [
/* gsap package looks like:
vendor/
gsap/
non-amd/
@aubricus
aubricus / example.html
Created Dec 7, 2017
FocusPoint JS Using Picture Element
View example.html
<div class="focuspoint"
role="presentation"
data-focus-x-sm="-0.27" data-focus-y-sm="0.98" data-image-w-sm="992" data-image-h-sm="685"
data-focus-x-md="-0.29" data-focus-y-md="1.00" data-image-w-md="1102" data-image-h-md="809"
data-focus-x-lg="-0.05" data-focus-y-lg="1.00" data-image-w-lg="1600" data-image-h-lg="879"
>
<picture class="img-presentation">
<source media="(min-width: 1200px)" srcset="http://cdn.com/path/to/marquee-lg.jpg">
<source media="(min-width: 992px)" srcset="http://cdn.com/path/to/marquee-md.jpg">
@aubricus
aubricus / reset_db.py
Last active Nov 11, 2017
django_extensions reset_db is incompatible with any .py file that accesses the database that's loaded during a `./manage.py` system checks cycle. This gist simply overrides the default `reset_db` command to disable these checks.
View reset_db.py
from django_extensions.management.commands.reset_db import Command as ResetDBCommand
class Command(ResetDBCommand):
requires_system_checks = False
help = "Override django-extensions reset_db and disable system_checks."
def handle(self, *args, **options):
self.stdout.write("Executing customized version of reset_db that disables system checks.")
super().handle(*args, **options)
@aubricus
aubricus / admin.py
Last active Oct 15, 2017
De-Dupe / Return Draft DjangoCMS Plugin Instances
View admin.py
def formfield_for_foreignkey(self, db_field, request, **kwargs):
if db_field.name == "my_plugin_fk":
kwargs["queryset"] = models.MyPluginModel.objects.filter(
Q(placeholder__static_draft__isnull=False) |
Q(placeholder__page__publisher_is_draft=True)
)
return super().formfield_for_foreignkey(db_field, request, **kwargs)