Skip to content

Instantly share code, notes, and snippets.

View erinxocon's full-sized avatar

Erin O'Connell erinxocon

View GitHub Profile
@erinxocon
erinxocon / deg2rad.ts
Last active April 29, 2018 01:41
toRad and toDeg conversion functions
interface Math {
toRadians(degrees: number): number;
toDegrees(radians: number): number;
}
// Converts from degrees to radians.
Math.radians = (degrees: number): number => {
return degrees * Math.PI / 180;
};
.blob-code-inner,
.blob-num,
.highlight pre {
font-family: "font name" !important;
font-size: 12px !important;
}
.pl-c,
.pl-e {
font-style: italic;
}
from flask import Flask, render_template, jsonify, redirect
from soco import SoCo
import json
app = Flask(__name__)
sonos = SoCo('10.0.1.153')
asdfasdfasdfasdf
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.2</TargetFramework>
<RootNamespace>dns_interceptor</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DNS" Version="5.0.0" />
import delegator
c = delegator.run('git branch -r --merged').pipe('grep -v -E "HEAD|store|stage"')
merged_branches = c.out.splitlines()[:-1]
for i in merged_branches:
stripped = i.strip()
replaced = stripped.replace('origin/', '')
try:
c = delegator.run('git show --format="%ci %cr %an" {0}'.format(stripped)).pipe('head -n 1')
@erinxocon
erinxocon / Dockerfile
Created October 17, 2019 21:10
Python 1.6.1 Ubuntu Dockerfile
FROM ubuntu:19.04
ARG DEBIAN_FRONTEND=noninteractive
# ensure local python is preferred over distribution python
ENV PATH /usr/local/bin:$PATH
# http://bugs.python.org/issue19846
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
ENV LANG C.UTF-8

Migrations

Automatic Model Migrations (probably the most common in the beginning of a project)

Well you add a new model to one of your apps, you add a new field to a model, you even change the help test for a model... Any of these changes can cause the need for a migration. How often how you started up your django project locally and it yells at you:

  Your models have changes that are not yet reflected in a migration, and so won't be applied.
 Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.
function New-Link {
param (
[Parameter(HelpMessage = "make a symbolic link", ParameterSetName = "switch")]
[Alias("symbolic")]
[switch]
$s,
[Parameter(HelpMessage = "make a hard link", ParameterSetName = "switch")]
[Alias("physical", "hard")]
[switch]
@erinxocon
erinxocon / profiles.json
Created December 28, 2020 04:37
My current windows terminal profiles json
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{07b52e3e-de2c-5db4-bd2d-ba144ed6c273}",
"copyOnSelect": false,
"copyFormatting": false,
"profiles": {
"defaults": {
"fontFace": "OperatorMono Nerd Font",
"fontSize": 13,
"acrylicOpacity": 0.75,