Skip to content

Instantly share code, notes, and snippets.

View chozabu's full-sized avatar

Alex P-B chozabu

View GitHub Profile
@chozabu
chozabu / tc.sh
Created December 1, 2016 13:21
bitcoins net limiter, altered to to make port selectable limit up/down and wipe iptables rules
# Copyright (c) 2013 The Bitcoin Core developers & Chozabu
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#network interface on which to limit traffic
IF="wlp3s0"
#limit of the network interface in question
LINKCEIL="1gbit"
#limit outbound in/out on selected port to this rate
LIMIT="1kbit"
@chozabu
chozabu / tc.sh
Created December 1, 2016 04:24
An altered version of tc.sh - given a port it will limit up/down traffic
# Copyright (c) 2013 The Bitcoin Core developers & Chozabu
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#network interface on which to limit traffic
IF="wlp3s0"
#limit of the network interface in question
LINKCEIL="1gbit"
#limit outbound in/out on selected port to this rate
LIMIT="1kbit"
@chozabu
chozabu / views_stripe.py
Last active September 8, 2016 18:04
Notes to self: The minor work I needed to do in app space to use djstripe.
from djstripe.contrib.rest_framework.views import SubscriptionRestView
class CustomSubscriptionRestView(SubscriptionRestView):
'''
This route expects data in this format \n
{
"stripe_token": "token-from-stripe.js",
"""time_subquerys.py: A quick task to compare subquerys on represent with."""
__author__ = "Alex 'Chozabu' P-B"
__copyright__ = "Copyright 2016, IAgree"
from django.core.management.base import BaseCommand, CommandError
from represent_app import models
import time
@chozabu
chozabu / time_subquerys.py
Created August 5, 2016 12:43
updated for pre-evaluated query
"""time_subquerys.py: A quick task to compare subquerys on represent with."""
__author__ = "Alex 'Chozabu' P-B"
__copyright__ = "Copyright 2016, IAgree"
from django.core.management.base import BaseCommand, CommandError
from represent_app import models
import time
"""time_subquerys.py: A quick task to compare subquerys on represent with."""
__author__ = "Alex 'Chozabu' P-B"
__copyright__ = "Copyright 2016, IAgree"
from django.core.management.base import BaseCommand, CommandError
from represent_app import models
import time
#!/usr/bin/env python2
"""picofix.py: reboot the a router when it fails to contact a distant node."""
__author__ = "Alex 'Chozabu' P-B"
import pyping
from time import sleep
from datetime import datetime
@chozabu
chozabu / views_push.py
Created June 12, 2016 21:35
Overriding Django Push Notifications "create" method to reassign user for an object if they send an identical regId
"""views_push.py: Views for push notifications, to register a device that would like to get push notifications."""
__author__ = "Alex 'Chozabu' P-B"
__copyright__ = "Copyright 2016, IAgree"
from push_notifications.api import rest_framework
from dj_represent import settings
from rest_framework.response import Response
@chozabu
chozabu / client_query_view.py
Created December 24, 2015 14:07
hobby code to allow a client to construct their own queries for a django server (do not use)
# /basic_api/?table=Post&sortby=-liquid_sum&startat=39
def db_query(request):
if len(request.POST) == 0:
r_get = request.GET
else:
r_get = request.POST
# table whitelist?
rdata = {"Post": Post, "Tag": Tag, "Topic": Topic, "User": User}
#copyright luke stanley & alex P-B
#AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
import hashlib
#from dictionary import lessFrequentButStillAutoSuggestableWords
#https://en.wiktionary.org/wiki/Wiktionary:Frequency_lists/PG/2005/08/60001-70000
"""
var script = document.createElement('script');
script.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(script);
lessFrequentButStillAutoSuggestableWords = [];