Skip to content

Instantly share code, notes, and snippets.

View betaflag's full-sized avatar
💭
Developing the future

Nicolas Lupien betaflag

💭
Developing the future
View GitHub Profile
@acarril
acarril / bootable-win-on-mac.md
Created November 18, 2022 17:49
Create a bootable Windows USB using macOS

For some reason, it is surprisingly hard to create a bootable Windows USB using macOS. These are my steps for doing so, which have worked for me in macOS Monterey (12.6.1) for Windows 10 and 11. After following these steps, you should have a bootable Windows USB drive.

1. Download a Windows disc image (i.e. ISO file)

You can download Windows 10 or Windows 11 directly from Microsoft.

2. Identify your USB drive

After plugging the drive to your machine, identify the name of the USB device using diskutil list, which should return an output like the one below. In my case, the correct disk name is disk2.

@SpainTrain
SpainTrain / config_model.py
Created June 12, 2017 17:19
Store Config for Google App Engine Python App in Datastore (https://12factor.net/config)
from os import environ
from google.appengine.ext import ndb
from google.appengine.ext.ndb import model
from pydash import snake_case
class Config(ndb.Model):
value = ndb.StringProperty()
value_previous = ndb.StringProperty()
@majackson
majackson / migrations.md
Last active May 2, 2025 17:50
Django migrations without downtime

Django Migrations without Downtime

The following instructions describe a set of processes allowing you to run Django database migrations against a production database without having to bring the web service down.

Note that in the below instructions, migrations are all run manually at explicit points, and are not an automatic part of the deployment process.

Adding Fields or Tables

Adding a (nullable) field or a new table

  1. Make the model or column addition in your code.
@kalmbach
kalmbach / gist:4471560
Created January 7, 2013 01:27
Rake task sugar for Sequel Migrations (version, migrate, rollback, reset)
namespace :db do
require "sequel"
Sequel.extension :migration
DB = Sequel.connect(ENV['DATABASE_URL'])
desc "Prints current schema version"
task :version do
version = if DB.tables.include?(:schema_info)
DB[:schema_info].first[:version]
end || 0
@aaugustin
aaugustin / convert_to_utc.py
Created June 22, 2012 08:52
Convert datetimes in the database when switching USE_TZ from False to True.
"""Convert datetimes in the database when switching USE_TZ from False to True.
tl;dr RUNNING THIS SCRIPT CAN RESULT IN DATA CORRUPTION, DATA LOSS AND EVEN
SERVER CRASHES. USE IT AT YOUR OWN RISK. NO WARRANTY WHATSOEVER.
This is a management command. Put it in the management.commands package of
one of your applications, then run: ./manage.py convert_to_utc <app_name> ...
This script assumes that no write operations take place while it's running.
It will rewrite every single record in your database; that's its whole point.