This file contains hidden or 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
shader_type canvas_item; | |
#define NUM_LAYERS 4. | |
mat2 rotate(float a) { | |
float s = sin(a), c = cos(a); | |
return mat2(vec2(c, -s), vec2(s, c)); | |
} | |
float star(vec2 uv, float flare) { |
This file contains hidden or 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
# Commodity price simulator | |
# | |
# pip install pygame | |
# pip install matplotlib | |
import random | |
import pygame | |
import matplotlib | |
matplotlib.use("Agg") |
This file contains hidden or 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
import pygame as pg | |
import sys | |
import collections | |
# Number of cells | |
CELL_GRID_WIDTH = 50 | |
CELL_GRID_HEIGHT = 50 | |
# Visible size of the cell | |
CELL_WIDTH = 10 |
This file contains hidden or 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
# I already added code to enable it. It should just work | |
# But it doesn't work on my machine either. I just followed the SDL2 docs... | |
# https://wiki.libsdl.org/SDL_CreateRenderer#flags | |
# You need to pass in SCALED to display.set_mode and have PYGAME_VSYNC=1 in your env vars | |
# vsync with opengl works differently | |
# vsync without SCALED is not planned by SDL2. | |
import os | |
os.environ["PYGAME_VSYNC"] = "1" |
This file contains hidden or 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
import random | |
import pygame | |
class Node: | |
def __init__(self, data=None): | |
self.data = data | |
self.left = None | |
self.right = None |
This file contains hidden or 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
from django import forms | |
from django.conf import settings | |
from django.contrib.auth.forms import AuthenticationForm | |
from django.core.mail import send_mail | |
class OTPAuthenticationForm(AuthenticationForm): | |
otp = forms.CharField(required=False, widget=forms.PasswordInput) | |
def clean(self): |
This file contains hidden or 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
session_data = 'ODE3Y2M0MzY5M2EzNTc2Zjc2Yzc1ZTNhZjkyNDMxZWJhY2MwYTJjMzqAAn1xAShVIXN0cmVldGxpZ2h0cnBjZm9ybV9xdWVyeV9hcHBtb2RlbFUngAJYDQAAAGtleWxpZ2h0X2NvcmVxAVULc3RyZWV0bGlnaHRxAoYuVQ1fYXV0aF91c2VyX2lkSwFVGHdvcmtwcm9ncmFtcnBjZm9ybV9xdWVyeVQYBQAAgAJjZGphbmdvLmNvbnRyaWIuZ2lzLmRiLm1vZGVscy5zcWwucXVlcnkKR2VvUXVlcnkKcQEpgXECfXEDKFUVYWdncmVnYXRlX3NlbGVjdF9tYXNrcQROVRdfYWdncmVnYXRlX3NlbGVjdF9jYWNoZXEFTlUFZXh0cmFxBmNkamFuZ28udXRpbHMuZGF0YXN0cnVjdHVyZXMKU29ydGVkRGljdApxBymBcQh9cQlVCGtleU9yZGVycQpdc2JVCGpvaW5fbWFwcQt9cQwoTlUKRUxfUFJPR1JBTXENTk50aA2Fc1UVcmVsYXRlZF9zZWxlY3RfZmllbGRzcQ5dVQxleHRyYV90YWJsZXNxDylVBnNlbGVjdHEQXXERVQZ0YWJsZXNxEl1xE2gNYVUMdXNlZF9hbGlhc2VzcRRjX19idWlsdGluX18Kc2V0CnEVXYVScRZVCG9yZGVyX2J5cRddcRhVCGRpc3RpbmN0cRmJVQ5kdXBlX2F2b2lkYW5jZXEafXEbVRBkZWZhdWx0X29yZGVyaW5ncRyIVQhncm91cF9ieXEdTlURc2VsZWN0X2Zvcl91cGRhdGVxHolVDnNlbGVjdF9yZWxhdGVkcR+JVRBkZWZlcnJlZF9sb2FkaW5ncSBoFV2FUnEhiIZxIlUNc2VsZWN0X2ZpZWxkc3EjXVUJYWxpYXNfbWFwcSR9cSVoDWNkamFuZ28uZGIubW9kZWxzLnNxbC5jb25zdGFudHMKSm9pbkluZm8KcSYoaA1oDU5OTk6JdIFx |
This file contains hidden or 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
SELECT TO_CHAR( | |
SDO_UTIL.TO_GMLGEOMETRY(sdo_geometry(2001, 8307, | |
sdo_point_type(-80, 70, null), | |
sdo_elem_info_array(1,1,1), sdo_ordinate_array(10, 10))) | |
) | |
AS GmlGeometry FROM DUAL; | |
# srsName="SDO:8307" | |
SELECT TO_CHAR( |
This file contains hidden or 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
#!/bin/bash | |
# Dockerfile generator for Django development mode | |
CONTAINER_USERNAME='dummy' | |
CONTAINER_GROUPNAME='dummy' | |
HOMEDIR='/home/'$CONTAINER_USERNAME | |
GROUP_ID=$(id -g) | |
USER_ID=$(id -u) | |
cat << _EOF_ > Dockerfile |
This file contains hidden or 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 MyManager(models.Manager): | |
use_for_related_fields = True | |
def get_query_set(self): | |
return super(MyManager, self).get_query_set().filter(is_deleted=False) | |
class MyModel(gis_models.Model): | |
is_deleted = models.BooleanField(default=False, db_index=True) | |
NewerOlder