Skip to content

Instantly share code, notes, and snippets.

View jinie's full-sized avatar

Jimmy Selgen Nielsen jinie

View GitHub Profile
@jinie
jinie / gist:712d397cfa37bcb836b5
Created July 17, 2015 12:12
EdgeOS GeoIP blocking
#!/usr/bin/env python
import os
import urllib2
countries={'DK':'denmark'}
os.system("/opt/vyatta/sbin/vyatta-cfg-cmd-wrapper begin")
for country in countries.keys():
@jinie
jinie / gist:7cbc7035508d32f00b52
Last active October 8, 2022 15:29
Pushover.net notifications with MQTT
#!/usr/bin/env python3
import paho.mqtt.client as paho
import http.client, urllib
import argparse
import logging
import json
import sys
def parse_message(self, message):
### Keybase proof
I hereby claim:
* I am jinie on github.
* I am jinie (https://keybase.io/jinie) on keybase.
* I have a public key whose fingerprint is 51FD 1BF4 2F94 14B8 4E9B FF85 E85B 6754 E8F6 1F7F
To claim this, I am signing this object:
@jinie
jinie / unifi
Last active August 29, 2015 13:57
Startup script for UniFi Controller
#!/bin/sh
### BEGIN INIT INFO
# Provides: unifi
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Should-Start: $network
# Should-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts the UniFi admin interface
@jinie
jinie / pushover.py
Created January 24, 2014 08:24
Login monitoring with Pushover
#!/usr/bin/env python
import re
import os
import urllib
import httplib
import logging
import pyinotify
from threading import Thread, Event
from socket import gethostname
#from logging.handlers import SysLogHandler
@jinie
jinie / curse_update.py
Last active December 25, 2015 20:19
Script to update WoW packages installed by Curse Client. usage : "curse_update.py Warcraft/Interface/Addons"
#!/usr/bin/env python
import os
import re
import logging
import fnmatch
try:
# For Python 3.0 and later
from urllib.request import urlopen
except ImportError:
# Fall back to Python 2's urllib2
@jinie
jinie / apns.py
Created September 9, 2013 13:35 — forked from fermion/apns.py
import socket, ssl, json, struct
import binascii
# device token returned when the iPhone application
# registers to receive alerts
deviceToken = '39cac56f 986a0e66 3c4fd4f4 68df5598 024d2ca3 8b9f307c 741c180e 9fc30c62'
thePayLoad = {
'aps': {
'alert':'Oh no! Server\'s Down!',
@jinie
jinie / iTC Downloader.py
Last active December 21, 2015 06:19 — forked from omz/iTC Downloader.py
# -*- coding: utf-8 -*-
# iTC Sales Report Downloader
# When you run this for the first time, you'll need to enter your
# iTunes Connect login and vendor ID. You can find the vendor ID
# on the iTunes Connect website by navigating to "Sales and Trends";
# it's the number next to your name (top-left).
CURRENCY = 'EUR'
RESET_LOGIN = False # Set to True to remove login from keychain
@jinie
jinie / .vimrc
Created August 15, 2013 18:54
.vimrc
set nocompatible " be iMproved
filetype on "Avoid errors on close
filetype off " required!
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" Bundles {{{-
" let Vundle manage Vundle
" required!
@jinie
jinie / gist:6074531
Last active December 20, 2015 04:59
#!/usr/bin/python
import socket
from threading import Thread
from Queue import Queue, Empty
class ClientSender(Thread):
def __init__(self, sock, queue):
super(ClientSender, self).__init__()
self.socket = sock
self.queue = queue