Skip to content

Instantly share code, notes, and snippets.

View pstjean's full-sized avatar

Peter St.Jean pstjean

View GitHub Profile
@ag-castro
ag-castro / image_validator.py
Created December 24, 2018 03:49
A validator image for Wagtail CMS
import os
from django.core.exceptions import ValidationError
from django.core.files.images import get_image_dimensions
from django.utils.deconstruct import deconstructible
from wagtail.images.models import Image # To get the image object from wagtail collections
@deconstructible
class ImageValidator:
"""ImageField dimensions validator."""
@xameeramir
xameeramir / default nginx configuration file
Last active April 15, 2024 09:51
The default nginx configuration file inside /etc/nginx/sites-available/default
# Author: Zameer Ansari
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
@dwilkie
dwilkie / ubuntu_unattended_upgrades_gmail.markdown
Created July 2, 2015 10:28
Setup unattended upgrades on Ubuntu with Gmail

Install the unattended-upgrades package

$ sudo apt-get install unattended-upgrades 

Edit the periodic configuration

$ sudo nano /etc/apt/apt.conf.d/10periodic
@RoyAwesome
RoyAwesome / (table) EntityFramework
Last active December 31, 2015 17:19
Notes for how Dota 2 interacts with it's Lua VM
Functions defined in dota\scripts\vscripts\framework\entities
--usage EntityFramework.CreateEntity(...)
CreateEntity [function, function: 0x169ab288]
GetScriptClassForDesignerName [function, function: 0x169a4d08]
GetNativeClassForScriptClass [function, function: 0x169a5258]
scriptClassTable [table, table: 0x169ab2c0]
InstallClasses [function, function: 0x169a77a8]
GetEntityHandle [function, function: 0x169ab310]
RegisterScriptClass [function, function: 0x169a7790]
@eric-hu
eric-hu / Open iterm tab here
Last active March 11, 2022 02:45
Apple script to open an iterm2 tab from right-clicking on a file or folder in Finder. To use: (1) Open Automator (2) Create a new service (3) Change "Service receives selected" drop downs to "Files or folders" in "Finder" (4) Select "Run applescript" from the sidebar, then paste this script in and save
-- Adapted from these sources:
-- http://peterdowns.com/posts/open-iterm-finder-service.html
-- https://gist.github.com/cowboy/905546
--
-- Modified to work with files as well, cd-ing to their container folder
on run {input, parameters}
tell application "Finder"
set my_file to first item of input
set filetype to (kind of (info for my_file))
-- Treats OS X applications as files. To treat them as folders, integrate this SO answer: