Skip to content

Instantly share code, notes, and snippets.

View smeggingsmegger's full-sized avatar

Scott Blevins smeggingsmegger

View GitHub Profile
@ChaosJohn
ChaosJohn / __init__py
Last active January 18, 2022 05:18 — forked from seanbehan/app.py
Flask with Django ORM
"""
Located under app/
"""
import os
from django.apps import apps
from django.conf import settings
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
@mosquito
mosquito / README.md
Last active April 27, 2024 00:07
Add doker-compose as a systemd unit

Docker compose as a systemd unit

Create file /etc/systemd/system/docker-compose@.service. SystemD calling binaries using an absolute path. In my case is prefixed by /usr/local/bin, you should use paths specific for your environment.

[Unit]
Description=%i service with docker compose
PartOf=docker.service
After=docker.service
@def-
def- / example.nim
Last active November 15, 2018 00:28
Reading a single character with Nim
import getch
let ch = getch()
echo ch
@kyledrake
kyledrake / ferengi-plan.txt
Last active April 6, 2024 00:30
How to throttle the FCC to dial up modem speeds on your website using Nginx
# The blog post that started it all: https://neocities.org/blog/the-fcc-is-now-rate-limited
#
# Current known FCC address ranges:
# https://news.ycombinator.com/item?id=7716915
#
# Confirm/locate FCC IP ranges with this: http://whois.arin.net/rest/net/NET-165-135-0-0-1/pft
#
# In your nginx.conf:
location / {
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active April 19, 2024 11:00
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

import sqlalchemy
from sqlalchemy import *
from sqlalchemy.ext.mutable import Mutable
class JSONEncodedObj(types.TypeDecorator):
"""Represents an immutable structure as a json-encoded string."""
impl = String
def process_bind_param(self, value, dialect):
@stevegrunwell
stevegrunwell / get_current_git_commit.php
Created August 15, 2012 21:44
Get current git HEAD using PHP
<?php
/**
* Get the hash of the current git HEAD
* @param str $branch The git branch to check
* @return mixed Either the hash or a boolean false
*/
function get_current_git_commit( $branch='master' ) {
if ( $hash = file_get_contents( sprintf( '.git/refs/heads/%s', $branch ) ) ) {
return $hash;
} else {
@vmihailenco
vmihailenco / monit_supervisor_programs.py
Created February 5, 2012 14:30
Monit/nagios script to monit supervisord programs state
#!/usr/bin/env python
import sys
import socket
import xmlrpclib
import argparse
def supervisord_processes(address):
try: