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
#!/bin/sh | |
PIPE=/tmp/somagic-pipe | |
OUTFILEDIR=~/dirs/Videos/ | |
LOGDIR=~/.somagic-log/ | |
NOW=`date +"%m_%d_%Y_%H_%M_%S"` | |
OUTFILE=${OUTFILEDIR}fpv_video_${NOW}.mp4 | |
mkdir $LOGDIR |
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
def get_actions(self, request): | |
actions = super(type(self), self).get_actions(request) | |
if 'delete_selected' in actions: | |
del actions['delete_selected'] | |
return actions | |
def has_delete_permission(self, request, obj=None): | |
return False | |
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
### models.py | |
from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin, BaseUserManager | |
from django.core.mail import send_mail | |
from django.db import models | |
from django.utils import timezone | |
from django.utils.translation import ugettext_lazy as _ | |
class UserManager(BaseUserManager): | |
use_in_migrations = True |
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
# http://stackoverflow.com/questions/21986602/fixed-length-int-obfuscator-does-anyone-know-how-to-do-this | |
class IntObfuscator(object): | |
m = 1000000000 | |
x = 387420489 | |
inverseX = 513180409 | |
def encode_int(self, value): | |
return value * self.x % self.m | |
def decode_int(self, encoded): |
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
import socket | |
def get_lock(process_name): | |
get_lock._lock_socket = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM) | |
try: | |
get_lock._lock_socket.bind('\0' + process_name) | |
return True | |
except socket.error: | |
return False |
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
[keyboard] | |
bindings = [ | |
{ key = "0", mods= "Control", chars = "\U0000001b[48;5u" }, | |
{ key = "1", mods= "Control", chars = "\U0000001b[49;5u" }, | |
{ key = "2", mods= "Control", chars = "\U0000001b[50;5u" }, | |
{ key = "3", mods= "Control", chars = "\U0000001b[51;5u" }, | |
{ key = "4", mods= "Control", chars = "\U0000001b[52;5u" }, | |
{ key = "5", mods= "Control", chars = "\U0000001b[53;5u" }, | |
{ key = "6", mods= "Control", chars = "\U0000001b[54;5u" }, | |
{ key = "7", mods= "Control", chars = "\U0000001b[55;5u" }, |
OlderNewer