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
@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": {

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',
.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."
@eupharis
eupharis / django_test_sqlite3.py
Last active December 27, 2015 15:09
faster django tests
if 'test' in sys.argv:
DATABASES['default']['ENGINE'] = 'django.db.backends.sqlite3'
@eupharis
eupharis / django_template_datetime_in_code.py
Created October 23, 2013 23:05
A nice way to get Python strings to be that nice default Django template datetime format.
from django.template import defaultfilters
from django.utils import timezone
localtime = timezone.template_localtime(my_date)
template_style_date = defaultfilters.date(localtime, settings.DATETIME_FORMAT)
# settings.DATETIME_FORMAT is the Django default by default, but can be overwritten in your settings.py
@eupharis
eupharis / rootscope_in_run.js
Last active December 24, 2015 10:59
Angular $rootScope in run method
var renderer2 = angular.module('pak', ['pak.filters', 'pak.services',...]);
renderer2.run(['$rootScope', function($rootScope) {
$rootScope.some_function = function() {
console.log('HELLO WORLD!!!!');
};
// function is available in all CHILD SCOPES
}]);