Skip to content

Instantly share code, notes, and snippets.

# ./manage.py shell_plus
# If you only have ONE database
from django.db import connection
from django.db.migrations.recorder import MigrationRecorder
from django.utils import timezone
recorder=MigrationRecorder(connection)
recorder.record_applied(app=app_name, name=migration_name)
# for multiple databases, for some reason, even if you specify the connection it doesn't work

Note for Dmitri/David: the Virtualbox/Cosmos instructions just document what you guys already went through. This doesn't require a second VM or anything.

Virtualbox

  • Download Ubuntu 18.04 ISO
  • Create new linux 64-bit VM in Virtualbox
  • Set memory to 4096 MB
  • Do “minimal installation”
  • Accept all other defaults
  • Increase VM video memory to max
  • sudo apt install gcc perl make
#!/usr/bin/env python3
from gnuradio import gr, blocks
def tlm_to_cosmos(list_of_temps):
tb = gr.top_block()
# sizeof_char == 1 byte in gnuradio land
nonblocking = False
STATE_TZ_MAP = {
'AK': 'US/Alaska',
'AL': 'US/Central',
'AR': 'US/Central',
'AS': 'US/Samoa',
'AZ': 'America/Phoenix', # Arizona is weird!
'CA': 'US/Pacific',
'CO': 'US/Mountain',
'CT': 'US/Eastern',
'DC': 'US/Eastern',
@eupharis
eupharis / states_by_fips.json
Last active January 19, 2022 19:36
State FIPS JSON (Abbreviation and Name)
{
"01": {
"abbreviation": "AL",
"name": "Alabama"
},
"02": {
"abbreviation": "AK",
"name": "Alaska"
},
"03": {
@eupharis
eupharis / angular-resolve.js
Created December 8, 2014 23:56
Example of angular resolve with "class" resolve and ensuring data is current on every route change.
(function() {
"use strict";
angular.module('JobListingApp')
.config(['$routeProvider', function($routeProvider) {
// ListingRoute "class" to ensure that all routes have
// current data in JobListings before they execute a route's controllers
var ListingRoute = function(params) {
angular.extend(this, params);
};
total = 0
RATE_OF_RETURN = 0.10
for i in range(1, 11, 2):
total += 23000 * ((1 + RATE_OF_RETURN) ** i)
# total in Roth IRA after 5 years
print total
# just earnings
print total - (5 * 23000)
/* http://nanobar.micronube.com/ || https://github.com/jacoborus/nanobar/ MIT LICENSE */
var Nanobar = (function () {
'use strict';
var addCss, animation, transEvent, createBar, Nanobar,
css = '.nanobar{float:left;width:100%;height:4px;z-index:9999;}.nanobarbar{width:0;height:100%;float:left;transition:all .3s;}',
head = document.head || document.getElementsByTagName( 'head' )[0];
// Create and insert style element in head if not exists
.directive('addRemoveUsers', ['$state', function($state) {
return {
link: function(scope, element, attrs) {
element.on('click', function() {
scope.$apply(function() {
if (scope.circle.all_circle) {
var msg = [
"An admin group's all circle contains all its users.",
"To remove users from this circle, please remove them",
"from the admin group."