Skip to content

Instantly share code, notes, and snippets.

View acdha's full-sized avatar

Chris Adams acdha

View GitHub Profile
@willurd
willurd / web-servers.md
Last active April 23, 2024 23:07
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@acdha
acdha / pre-commit
Last active April 18, 2024 02:22
Git pre-commit hook which runs various code linters. Install this to .git/hooks/pre-commit inside your favorite repos
#!/usr/bin/env PYTHONIOENCODING=utf-8 python
# encoding: utf-8
"""Git pre-commit hook which lints Python, JavaScript, SASS and CSS"""
from __future__ import absolute_import, print_function, unicode_literals
import os
import subprocess
import sys
@sators
sators / connect.php
Last active April 11, 2024 07:17
PHP MySQLi Amazon Aurora RDS EC2 IAM Role Based Authentication
<?php
/********* CONFIG ********/
$clusterEndpoint = "";
$clusterPort = 3306;
$clusterRegion = "us-east-1";
$dbUsername = "";
$dbDatabase = "";
/*************************/
@pmbaumgartner
pmbaumgartner / cloud-init.yaml
Last active March 26, 2024 17:47
Multipass & Docker Setup
#cloud-config
package_upgrade: true
ssh_authorized_keys:
- <your key>
packages:
- apt-transport-https
- ca-certificates
- curl
@impressiver
impressiver / raven-config.html
Last active February 27, 2024 14:27
Raven.js configuration for logging JavaScript exceptions to Sentry (https://getsentry.com/). Without the added ignore options, you'll quickly find yourself swamped with unactionable exceptions due to shoddy browser plugins and 3rd party script errors.
<!-- Raven.js Config -->
<script src="{{ JS_PATH }}/lib/raven.js" type="text/javascript"></script>
<script type="text/javascript">
// Ignore list based off: https://gist.github.com/1878283
var ravenOptions = {
// Will cause a deprecation warning, but the demise of `ignoreErrors` is still under discussion.
// See: https://github.com/getsentry/raven-js/issues/73
ignoreErrors: [
// Random plugins/extensions
'top.GLOBALS',
@caseywatts
caseywatts / 0 README.md
Last active August 30, 2023 06:50
Generate Graphviz Files for Project

short url: caseywatts.com/graphviz

Graphviz is like markdown, for diagrams.

It's a tool that can transform text input into a "directed graph" output, which is nodes pointing to other nodes. You can use it for architecture diagrams, DB diagrams, documentation for users, etc.

graphviz-it

You'll want to use a tool with a two-pane layout - the left side is the source text, the right side is the image output.

  • For just you working on it, use (shown above; it has more features)
@diafygi
diafygi / slow_query_log_dump.py
Created December 16, 2011 04:38 — forked from memonic/cronjob.sh
Script to transform Amazon RDS slow log table into the MySQL slow query log format
"""
Queries the slowlog database table maintained by Amazon RDS and outputs it in
the normal MySQL slow log text format. Modified version of the script by
memonic (Thanks!) at https://gist.github.com/1481025
Things to change in this script for your own setup:
<root_user> to your mysql root user (e.g. "root")
<root_pass> to your mysql root password (e.g. "hunter2")
<host_domain> to your mysql root password (e.g. "prod-01.w3rfs2.us-east-1.rds.amazonaws.com")
@jmcnamara
jmcnamara / bench_excel_writers.py
Last active August 4, 2022 21:06
Benchmark of several Python Excel writing modules
##############################################################################
#
# Simple Python program to benchmark several Python Excel writing modules.
#
# python bench_excel_writers.py [num_rows] [num_cols]
#
#
import sys
from time import clock

The citations game: Pressman Ratios

Rubric: Software Engineering : Factual Claims : Defect Cost Increase : Pressman Ratios

Context

See previous note on the IBM Systems Sciences Institute

Origins

@dpnova
dpnova / gist:1223933
Created September 17, 2011 13:26
invalidate cache_page entries in django
def expire_view_cache(view_name, args=[], namespace=None, key_prefix=None, method="GET"):
"""
This function allows you to invalidate any view-level cache.
view_name: view function you wish to invalidate or it's named url pattern
args: any arguments passed to the view function
namepace: optioal, if an application namespace is needed
key prefix: for the @cache_page decorator for the function (if any)
from: http://stackoverflow.com/questions/2268417/expire-a-view-cache-in-django
added: method to request to get the key generating properly