Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Grokzen Grokzen

🏠
Working from home
  • Dynamist (https://dynamist.se/)
  • Sweden
View GitHub Profile
View gist:affc6c37715c80e24932325c3872ef59
#
# extras.urls
#
# Custom Field choices
router.register(r'_custom_field_choices', views.CustomFieldChoicesViewSet, base_name='field-choice')
#
# extras.api.views
#
class CustomFieldChoicesViewSet(ViewSet):
View pipeline test
#!/usr/bin/env python
import rediscluster
import uuid
import sys
import time
def create_connection():
startup_nodes = [
{'host': '127.0.0.1', 'port': 7000},
{'host': '127.0.0.1', 'port': 7001},
@Grokzen
Grokzen / reclaimWindows10.ps1
Created Jan 8, 2017 — forked from alirobe/reclaimWindows10.ps1
"Reclaim Windows 10" turns off a bunch of unnecessary Windows 10 telemetery, removes bloatware, and privacy invasions. Review and tweak before running. Scripts for reversing are included and commented. Fork via https://github.com/Disassembler0 (different defaults)
View reclaimWindows10.ps1
##########
# Win10 Initial Setup Script
# Author: Disassembler <disassembler@dasm.cz>
# Version: 1.7, 2016-08-15
# dasm's script: https://github.com/Disassembler0/Win10-Initial-Setup-Script/
# THIS IS A PERSONALIZED VERSION
# This script leaves more MS defaults on, including MS security features.
# Tweaked based on personal preferences for @alirobe 2016-11-16 - v1.7.1
View gist:8109ef4c0b4fb149e8ee
@@ -397,7 +400,8 @@ class StrictRedis(object):
charset=None, errors=None,
decode_responses=False, retry_on_timeout=False,
ssl=False, ssl_keyfile=None, ssl_certfile=None,
- ssl_cert_reqs=None, ssl_ca_certs=None):
+ ssl_cert_reqs=None, ssl_ca_certs=None,
+ max_connections=None):
if not connection_pool:
if charset is not None:
warnings.warn(DeprecationWarning(
@Grokzen
Grokzen / foo.py
Last active Jun 26, 2020
Symmetrical ManyToMany Filter Horizontal in Django Admin
View foo.py
# Based on post from: https://snipt.net/chrisdpratt/symmetrical-manytomany-filter-horizontal-in-django-admin/#L-26
# Only reposting to avoid loosing it.
"""
When adding a many-to-many (m2m) relationship in Django, you can use a nice filter-style multiple select widget to manage entries. However, Django only lets you edit the m2m relationship this way on the forward model. The only built-in method in Django to edit the reverse relationship in the admin is through an InlineModelAdmin.
Below is an example of how to create a filtered multiple select for the reverse relationship, so that editing entries is as easy as in the forward direction.
"""
### pizza/models.py ###
@Grokzen
Grokzen / sp
Last active Aug 29, 2015 — forked from wandernauta/sp
View sp
#!/bin/bash
#
# This is sp, the command-line Spotify controller. It talks to a running
# instance of the Spotify Linux client over dbus, providing an interface not
# unlike mpc.
#
# Put differently, it allows you to control Spotify without leaving the comfort
# of your command line, and without a custom client or Premium subscription.
#
@Grokzen
Grokzen / fuzzy.py
Created Jul 10, 2013
Tiny lib that will perform a simple version of fuzzy string matching, similar to what sublime text use.
View fuzzy.py
import difflib
def match(key, search_for):
a = [char for char in search_for]
index = 0
for char in key:
if a[index] == char:
index += 1
if index == len(a):
You can’t perform that action at this time.