Skip to content

Instantly share code, notes, and snippets.

View mikesdnielsen's full-sized avatar

Mike Nielsen mikesdnielsen

View GitHub Profile
@joestump
joestump / unifi.py
Created July 15, 2020 03:36
A simple Python client for the Ubiquiti UDM Pro
import requests
import json
import urllib3
UNIFI_LOGIN_PATH = '/api/auth/login'
# Disable SSL verification warnings
urllib3.disable_warnings()
@egnha
egnha / build-emacs-mac.md
Last active September 27, 2024 08:21
Build Emacs on the Mac

Build Emacs on the Mac

emacs-mac by Mitsuharu Yamamoto enhances vanilla GNU Emacs by enabling various Safari-like conveniences, such as tabs and tab overview and back/forward swiping between buffers. It also enables various Mac-specific Elisp commands, such as (mac-auto-operator-composition-mode) to enable font ligatures.

You can install a pre-built binary with the Homebrew formula provided by railwaycat. But be aware that you can't launch it from Spotlight, because it doesn't install Emacs.app in /Applications (you'd have to do that manually).

Install dependencies

brew install autoconf gnutls pkg-config texinfo
@wzulfikar
wzulfikar / .drone.yml
Last active August 26, 2021 17:51
Drone CI slack template. more on drone.io + slack integration: http://plugins.drone.io/drone-plugins/drone-slack/
pipeline:
build:
image: alpine
commands:
- echo "do something :v"
slack:
image: plugins/slack
channel: dev__builds
webhook: https://hooks.slack.com/services/...
@jedie
jedie / migration_filer_deprecation_move.py
Created April 30, 2018 15:57 — forked from wfehr/migration_filer_deprecation_move.py
Migration to move deprecated cmsplugin-*-plugins to the newer djangocms-*-plugins
from django.apps import apps as global_apps
from django.db import migrations
from djangocms_file.models import get_templates as get_file_templates
from djangocms_picture.models import get_templates as get_picture_templates
def forwards_filer_file(apps, schema_editor):
try:
CMSPluginFilerFile = apps.get_model('cmsplugin_filer_file',
'FilerFile')
@qwexvf
qwexvf / app.py
Created October 17, 2017 07:17
Python Steam Login
from flask import Flask, redirect
from urllib import parse
import requests
import json
app = Flask(__name__)
@app.route('/')
def hello_world():
steam_openid_url = 'https://steamcommunity.com/openid/login'
@bruce-shi
bruce-shi / disable_signals.py
Created September 18, 2016 02:44 — forked from RobertKolner/disable_signals.py
Temporarily disable all signals in django.
from collections import defaultdict
from django.db.models.signals import *
class DisableSignals(object):
def __init__(self, disabled_signals=None):
self.stashed_signals = defaultdict(list)
self.disabled_signals = disabled_signals or [
pre_init, post_init,
pre_save, post_save,
@baxeico
baxeico / allow_cors_mixin.py
Last active August 6, 2020 13:40
Simple mixin to add CORS headers in a Django View
from django.http import HttpResponse
class AllowCORSMixin(object):
def add_access_control_headers(self, response):
response["Access-Control-Allow-Origin"] = "*"
response["Access-Control-Allow-Methods"] = "GET, OPTIONS"
response["Access-Control-Max-Age"] = "1000"
response["Access-Control-Allow-Headers"] = "X-Requested-With, Content-Type"
@hollodotme
hollodotme / Install-nginx-with-http2-support.md
Created April 9, 2016 17:07
Install nginx with http2 support on ubuntu 14.04 LTS (Trusty)

How to install nginx (>= 1.9.5) with http2 support on Ubuntu 14.04 LTS (Trusty)

IMPORTANT: Backup your nginx site configs (usually under /etc/nginx/sites-available)!

Remove old nginx

Remove old nginx incl. nginx-common:

apt-get autoremove --purge nginx nginx-common
@Komzpa
Komzpa / upgrade-postgres-9.4-to-9.5-to-9.6-to-10.md
Last active January 15, 2021 18:04 — forked from dideler/upgrade-postgres-9.3-to-9.4.md
Upgrading PostgreSQL from 9.4 to 9.5 to 9.6 to 10 when upgrading Ubuntu 14.10 to 16.04

TL;DR

9.4 -> 9.5:

sudo pg_dropcluster 9.5 main --stop
sudo service postgresql stop
sudo pg_upgradecluster -m upgrade -k 9.4 main
sudo su postgres -c "/usr/lib/postgresql/9.5/bin/vacuumdb --all --analyze-in-stages"
sudo pg_dropcluster 9.4 main
@bwbaugh
bwbaugh / server-name-wordlist-mnemonic.txt
Last active September 28, 2024 22:45
Server name wordlist (mnemonic)
# Original blog post: <https://mnx.io/blog/a-proper-server-naming-scheme/>
# Original word list: <http://web.archive.org/web/20091003023412/http://tothink.com/mnemonic/wordlist.txt>
# Sample usage: `curl <gist> | tail --lines +4 | shuf | head --lines 1`
acrobat
africa
alaska
albert
albino
album
alcohol