Skip to content

Instantly share code, notes, and snippets.

View adampetrovic's full-sized avatar
😀

Adam Petrovic adampetrovic

😀
View GitHub Profile
@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>.*)$"
}
},
@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 = {}
!BLK Cursor
URxvt.color0 : #000d18
URxvt.color8 : #000d18
!RED Tag
URxvt.color1 : #e89393
URxvt.color9 : #e89393
!GRN SpecialKey
URxvt.color2 : #9ece9e
<?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)){
Marking scheme for Electronic Book Store
========================================
Username: 308165721
Automarking tests
-----------------
1/1 create user: base (*)
1/1 create user: duplicate