This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add this code in any Django app's admin.py | |
# Works for all Task Statuses; you can filter them in line 12. | |
import ast | |
import importlib | |
import json | |
from django.contrib import admin | |
from django.contrib import messages | |
from django.utils.safestring import mark_safe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
The format for converting UUID's to integers is as follows | |
CONV(LEFT(HEX(`uuid_from_bin` (`uuid_v5` (<a static uuid value>,<the uuid field>))),8),16,10) AS id | |
MYSQL User Defined Functions | |
uuid_from_bin | |
and uuid_v5 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DROP FUNCTION IF EXISTS uuid_from_bin; | |
DROP FUNCTION IF EXISTS uuid_to_bin; | |
DROP FUNCTION IF EXISTS uuid_v5; | |
DROP FUNCTION IF EXISTS uuid_v4; | |
DELIMITER // | |
CREATE FUNCTION uuid_from_bin(b BINARY(16)) | |
RETURNS CHAR(36) | |
BEGIN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Step 1: Open file ~/.bashrc | |
Step 2: Uncomment forece_color_prompt=yes | |
# uncomment for a colored prompt, if the terminal has the capability; turned | |
# off by default to not distract the user: the focus in a terminal window | |
# should be on the output of commands, not on the prompt | |
force_color_prompt=yes | |
Step 3: Comment PS1 style. Add the following code to end of ~/.bashrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# creating and testing permissions and test groups in django tests. | |
from django.contrib.auth.models import User, Permission, Group | |
from django.test import TestCase | |
from django.test import Client | |
class ExampleGroupPermissionsTests(TestCase): | |
def setUp(self): | |
#create permissions group |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [ -f /etc/bashrc ]; then | |
. /etc/bashrc | |
fi | |
if [ -f /etc/bash_completion ]; then | |
. /etc/bash_completion | |
fi | |
xhost +local:root > /dev/null 2>&1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create a new repository on the command line | |
touch README.md | |
git init | |
git add README.md | |
git commit -m "first commit" | |
git remote add origin https://github.com/c0ldlimit/vimcolors.git | |
git push -u origin master | |
# Push an existing repository from the command line |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyView(CreateView): | |
model = Team | |
def form_valid(self, form): | |
self.object = form.save(commit=False) | |
self.object.user = self.request.user | |
self.object.save() | |
return FormMixin.form_valid(self, form) |