Skip to content

Instantly share code, notes, and snippets.

View adampetrovic's full-sized avatar

Adam Petrovic adampetrovic

View GitHub Profile
Marking scheme for Electronic Book Store
========================================
Username: 308165721
Automarking tests
-----------------
1/1 create user: base (*)
1/1 create user: duplicate
<?php
function validate_abn($abn){
$abn = str_replace(" ", "", $abn);
$abn_char = preg_split('//', $abn, -1, PREG_SPLIT_NO_EMPTY);
$weight_factors = array(10,1,3,5,7,9,11,13,15,17,19);
foreach($abn_char as $digit){
if(!is_numeric($digit)){
!BLK Cursor
URxvt.color0 : #000d18
URxvt.color8 : #000d18
!RED Tag
URxvt.color1 : #e89393
URxvt.color9 : #e89393
!GRN SpecialKey
URxvt.color2 : #9ece9e
@adampetrovic
adampetrovic / github.py
Last active August 29, 2015 13:57
A search script for finding popular users on Github using their API. Useful for recruiting purposes ;)
import requests
import time
import sys
URL = "https://api.github.com/search/users"
MAX_PAGE = 100
class GithubQuery(object):
results = {}
@adampetrovic
adampetrovic / haproxy-http.json
Created September 28, 2015 01:55
lnav haproxy format
{
"haproxy_http" : {
"title" : "HAProxy HTTP Log Format",
"description" : "The HAProxy log format for HTTP backends",
"url" : "http://www.haproxy.org/download/1.4/doc/configuration.txt",
"regex" : {
"std" : {
"pattern" : "^(?<timestamp>\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\+\\d{2}:\\d{2}) (?<logging_host>[^ ]+) (?<process_name>\\w+)\\[(?<pid>\\d+)]: (?<client_ip>[^:]+):(?<client_port>\\d+) \\[(?<accept_date>[^\\]]+)] (?<frontend_name>[^ ]+) (?<backend_name>[^ ]+)/(?<server_name>[^ ]+) (?<tq>\\d+)/(?<tw>\\d+)/(?<tc>\\d+)/(?<tr>\\d+)/(?<tt>\\d+) (?<status_code>\\d+) (?<bytes_read>\\d+) (?<captured_request_cookie>.*) (?<captured_response_cookie>.*) (?<termination_state>.*) (?<actconn>\\d+)/(?<feconn>\\d+)/(?<beconn>\\d+)/(?<srv_conn>\\d+)/(?<retries>\\d+) (?<srv_queue>\\d+)\/(?<backend_queue>\\d+) \\{(?<captured_request_headers>.*)} (?<http_request>.*)$"
}
},

Keybase proof

I hereby claim:

  • I am adampetrovic on github.
  • I am adampetrovic (https://keybase.io/adampetrovic) on keybase.
  • I have a public key ASDgb_44RUH8mlbweiMeVxO5Cq2PYG9WM1UPHOrC3ftxdgo

To claim this, I am signing this object:

@adampetrovic
adampetrovic / README.md
Last active September 14, 2016 02:13
StarTrack Email Updates
  • Python 3
  • Gmail by default
  • Install requests (pip install requests)
  • Create the directory '.search_cache' where you are running the script from
  • Update EMAIL_ADDRESS and EMAIL_PASSWORD
  • Usage: python startrack_check.py
  • reference can be your 'TL' tracking code, or SBS from Telstra
@adampetrovic
adampetrovic / sentiment.py
Created February 9, 2018 03:22
Sentiment Analysis
import nltk
from instanalyze.logic import tweet_gen
# import tweet_gen
import pickle
import os
from instanalyze.logic.classifier import NaiveBayesClassifier
def create_data_path(relative_path):
path = os.getcwd()
if 'instanalyze' not in os.getcwd():
@adampetrovic
adampetrovic / config.yaml
Created August 20, 2021 00:54
Frigate Config
detectors:
coral:
type: edgetpu
device: usb
ffmpeg:
input_args: >-
-avoid_negative_ts make_zero -fflags +genpts+discardcorrupt
-use_wallclock_as_timestamps 1
hwaccel_args:
from dateutil import parser, tz
from datetime import datetime, timezone
MAX_TIME_RANGE = 12 * 60 # how many minutes in the future to look at forecasts
BATTERY_CAPACITY = 82 # kWh - Tesla Model 3 Performance (2021)
CHARGE_RATE = 11 # kWh - Gen 3 Wall Connector (3 Phase 16A)
LOCAL_TZ = tz.gettz('Australia/Sydney')
def get_price_forecast():