Skip to content

Instantly share code, notes, and snippets.

View SuperSuperDev's full-sized avatar
🎯
Focusing

Steven Saunders SuperSuperDev

🎯
Focusing
View GitHub Profile
@SuperSuperDev
SuperSuperDev / 0_reuse_code.js
Last active August 29, 2015 14:15
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@SuperSuperDev
SuperSuperDev / git-dev-branch
Last active May 21, 2021 17:13
Git Command Dev Branch
```gco -b name-of-branch```
MAKE THE CODE CHANGES YOU NEED FOR YOUR FEATURE!
git add .
git commit -m "my great new feature" (You can add and commit as often as you like at this stage. Recommend at least daily)
gco development (check out your development branch)
git pull origin development (pull the latest from github)
gco name-of-branch (check out your feature branch)
git merge development Merge your development branch into your feature branch.
If there were any conflicts, resolve them, involving your team as needed. Make sure to test your program after doing this!
git add . (Only necessary if there were conflicts)
[MESSAGES CONTROL]
disable=arguments-differ,missing-function-docstring,missing-class-docstring,no-self-use,raise-missing-from,no-member,missing-module-docstring,invalid-name,too-few-public-methods, relative-beyond-top-level
@SuperSuperDev
SuperSuperDev / settings.json
Last active June 15, 2021 23:48
vscode settings
{
"workbench.colorCustomizations": {
"statusBar.background": "#fe5ede",
"titleBar.activeBackground": "#fe5ede",
"titleBar.inactiveBackground": "#fe5ede99",
"statusBar.foreground": "#15202b",
"titleBar.inactiveForeground": "#15202b99",
"titleBar.activeForeground": "#15202b",
"activityBar.activeBackground": "#fe91e8",
"activityBar.activeBorder": "#657e01",
# Resetting a Postgres DB w Django
#django
* Drop the database `dropdb db_name`
* Delete migration...except `__init__.py`
* create the db again, `createdb db_name`
* make migration `python manage.py makemigrations`
* migrate `python manage.py migrate`
* If you want to re seed, you can now `python loadata .......`

Seeding Data in Django

#django

  • Have Django create a seeds file automatically from the data that already exists in the table python manage.py dumpdata app-name --output app-name/seeds.json --indent=2 - Depending on if you need to change...command could be a one time thing.
  • Empty the database of all rows inside currently. python manage.py flush and answer "yes" when prompted.
  • Load your data from the seeds file, back into the database. python manage.py loaddata app_name/seeds.json
  • Create your superuser again, as you have been deleted too... Show more

ogr2ogr th-adm-0.geojson -f "GeoJSON" -lco id_field=ADM0_PCODE -t_srs "EPSG:4326" tha_admbnda_adm0_rtsd_20190221.shp

@SuperSuperDev
SuperSuperDev / postgreSQLShellCommands.md
Last active October 6, 2021 22:56
PostgreSQL Shell Commands

PostgreSQL Commands

Install PostgreSQL (Ubuntu)

Update the apt package index

sudo apt-get update
@SuperSuperDev
SuperSuperDev / geoDjangoSeed.md
Last active October 11, 2021 16:12
geoDjango Commands

Seed geoDjango with SHapefiles

Inspect the shapefiles

ogrinfo -so ./thailand/data/tha_adm_rtsd_itos_20190221_SHP_PART_1/tha_admbnda_adm1_rtsd_20190221.shp tha_admbnda_adm1_rtsd_20190221
import ogr
@SuperSuperDev
SuperSuperDev / wagtail-import-data.md
Created October 5, 2021 22:17 — forked from tomdyson/wagtail-import-data.md
Create 35k Wagtail pages of Wikipedia film plots

Create Wagtail pages programmatically

This short recipe demonstrates how to create Wagtail pages programmatically. It may also be useful for testing Wagtail development against a reasonable volume of page data (about 35,000 film plots, from English Wikipedia).

Instructions

In a virtualenv: