Skip to content

Instantly share code, notes, and snippets.

View aubricus's full-sized avatar
Coffee.

Aubrey Taylor aubricus

Coffee.
View GitHub Profile
@aubricus
aubricus / License
Last active June 20, 2023 01:19
Python Progress Bar
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 / __init__.py
Last active November 27, 2022 01:19 — forked from yuvadm/fabfile.py
Using Fabric to connect to the remote server via an ssh config.
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 / create-new-file.ahk
Created August 16, 2011 00:00
AutoHotkey script to create a new file.
; 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 / pyenv-mojave.sh
Last active January 29, 2019 00:10 — forked from excenter/rune.bash
Mojave pyenv update
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 November 20, 2018 02:41 — forked from gilzow/put-inside-functions.php
Removes user endpoints from WordPress REST API
<?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 February 24, 2014 08:48
Use pandoc to convert README.md into .rst for Pypi
long_description = ''
try:
import subprocess
import pandoc
process = subprocess.Popen(
['which pandoc'],
shell=True,
stdout=subprocess.PIPE,
@aubricus
aubricus / 01_common.js
Last active January 11, 2018 09:37
Load Greensock TweenLite and TimelineLite with Require.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 December 7, 2017 04:14
FocusPoint JS Using Picture Element
<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 November 11, 2017 11:32
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.
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 October 15, 2017 10:19
De-Dupe / Return Draft DjangoCMS Plugin Instances
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)