Skip to content

Instantly share code, notes, and snippets.

View Ryanb58's full-sized avatar

Taylor Brazelton Ryanb58

View GitHub Profile
@tcwalther
tcwalther / delayedinterrupt.py
Last active February 2, 2024 14:59
DelayedInterrupt class - delaying the handling of process signals in Python
import signal
import logging
# class based on: http://stackoverflow.com/a/21919644/487556
class DelayedInterrupt(object):
def __init__(self, signals):
if not isinstance(signals, list) and not isinstance(signals, tuple):
signals = [signals]
self.sigs = signals
@wpscholar
wpscholar / vagrant-cheat-sheet.md
Last active June 8, 2024 16:18
Vagrant Cheat Sheet

Typing vagrant from the command line will display a list of all available commands.

Be sure that you are in the same directory as the Vagrantfile when running these commands!

Creating a VM

  • vagrant init -- Initialize Vagrant with a Vagrantfile and ./.vagrant directory, using no specified base image. Before you can do vagrant up, you'll need to specify a base image in the Vagrantfile.
  • vagrant init <boxpath> -- Initialize Vagrant with a specific box. To find a box, go to the public Vagrant box catalog. When you find one you like, just replace it's name with boxpath. For example, vagrant init ubuntu/trusty64.

Starting a VM

  • vagrant up -- starts vagrant environment (also provisions only on the FIRST vagrant up)
@chantastic
chantastic / on-jsx.markdown
Last active May 30, 2024 13:11
JSX, a year in

Hi Nicholas,

I saw you tweet about JSX yesterday. It seemed like the discussion devolved pretty quickly but I wanted to share our experience over the last year. I understand your concerns. I've made similar remarks about JSX. When we started using it Planning Center, I led the charge to write React without it. I don't imagine I'd have much to say that you haven't considered but, if it's helpful, here's a pattern that changed my opinion:

The idea that "React is the V in MVC" is disingenuous. It's a good pitch but, for many of us, it feels like in invitation to repeat our history of coupled views. In practice, React is the V and the C. Dan Abramov describes the division as Smart and Dumb Components. At our office, we call them stateless and container components (view-controllers if we're Flux). The idea is pretty simple: components can't

@adrianorsouza
adrianorsouza / mkselfssl.sh
Last active September 1, 2023 10:34
Script to create a new self-signed SSL Certificate for Nginx
#!/bin/bash
# @author Adriano Rosa (http://adrianorosa.com)
# @date: 2014-05-13 09:43
#
# Bash Script to create a new self-signed SSL Certificate
# At the end of creating a new Certificate this script will output a few lines
# to be copied and placed into NGINX site conf
#
# USAGE: this command will ask for the certificate name and number in days it will expire
@hlawrenz
hlawrenz / flower command line
Last active February 5, 2023 19:00
Serve celery flower behind Django authentication.
celery flower --address=127.0.0.1 --url_prefix=flower --broker=<broker url>
@mezis
mezis / query_finder.sql
Last active May 26, 2024 20:03
Finding long-running queries in MySQL
SELECT id,state,command,time,left(replace(info,'\n','<lf>'),120)
FROM information_schema.processlist
WHERE command <> 'Sleep'
AND info NOT LIKE '%PROCESSLIST%'
ORDER BY time DESC LIMIT 50;
@rafi
rafi / i3status.conf
Last active February 1, 2023 12:33
Rafi's i3status configuration file
# github.com/rafi i3status config
# i3status configuration file
# see "man i3status" for documentation.
# It is important that this file is edited as UTF-8.
# The following line should contain a sharp s:
# ß
# If the above line is not correctly displayed, fix your editor first!
@jirutka
jirutka / webdav_treat_osx.conf
Created April 14, 2013 00:28
Nginx optimization for WebDAV access from OS X Finder. This config snippet ensures that nginx will ignore requests for useless dot files generated by the Finder (.DS_Store, ._*, …)
#
# Ignore requests for useless dot files generated by OS X Finder (WebDAV).
#
# This little hack speeds-up a WebDAV access from the Finder significantly and
# also prevents messing storage with these annoying files.
#
location ~ \.(_.*|DS_Store|Spotlight-V100|TemporaryItems|Trashes|hidden)$ {
access_log off;
error_log off;
@magopian
magopian / tests.py
Created November 16, 2012 10:55
Unit test to validate django templates
class TemplatesTest(TestCase):
def test_templates(self):
"""Templates can compile properly and there's no mismatched tags"""
# get app template dirs
template_dirs = []
apps = [app for app in settings.INSTALLED_APPS
if app.startswith('rh2')]
for app in apps:
mod = import_module(app)
@schovi
schovi / curl.example
Created September 14, 2012 17:58
How to use httpie instal of curl with elasticsearch
$ curl -XPUT 'http://localhost:9200/twitter/' -d '{
index : {
number_of_shards : 3
number_of_replicas : 2
}
}'