Skip to content

Instantly share code, notes, and snippets.

View linuxct's full-sized avatar

linuxct linuxct

View GitHub Profile
if (Build.MANUFACTURER.toLowerCase(Locale.US).contains("sony")) {
if (backup) {
os.writeBytes("echo 'backup_rom /sdcard/clockworkmod/backup/ota_" +
new SimpleDateFormat("yyyy-MM-dd_HH.mm", Locale.US).format(new Date()) +
"' >> /cache/recovery/extendedcommand\n");
}
if (wipeData) {
os.writeBytes("echo 'format(\"/data\");' >> /cache/recovery/extendedcommand\n");
}
if (wipeCache) {
@linuxct
linuxct / arch-shell.sh
Last active August 17, 2017 22:44 — forked from JuanjoSalvador/debian-shell.sh
Archlinux package managers shell aliases
# Place the content of this script at the bottom of your ~/.bashrc file (or ~/.zshrc if you are using ZSH).
# Please be ensure that your shell doesn't have any alias or plugin with the following names: paci, pacu, pacr, pacq, pacd, pacl
# Replace 'pacman' with 'pacaur' if you want to use it instead,
PMG="pacman"
if [ "$PMG" = "pacman" ]; then
ELEVATOR="sudo"
elif [ "$PMG" = "pacaur" ]; then
ELEVATOR=""
@linuxct
linuxct / 0-Django-MVC-pt1-notes.md
Last active July 30, 2022 02:56
First part of my attempt at implementing MVC logic in Python with Django and Wagtail

Introduction

While tinkering with Wagtail (and inherently, Django), I found myself in no time with a very large views.py file due to how Django sets up its endpoint management. For this reason, I decided I would attempt at segregating the responsibility of views.py into separate files/classes, in order to make it easier to maintain and read.

The idea is close to an MVC pattern. Ideally there will be a Controller that will implement the Action (endpoint) logic, which will parse the request, its data, and will implement the necessary logic for the data lookup part. The result of this will be converted into a ViewModel (Data class) which will be passed to a View (Django template), ideally binding them together.

Implementation details

I have decided to implement a ControllerBase (see below), that will be inherited by the rest of the Controllers in the solution. All redundant logic, as well as the necessary methods needed in order to support Django's decorators, will be implemented and