Skip to content

Instantly share code, notes, and snippets.

@SavvyGuard
SavvyGuard / mac_os_mouse_browser.json
Created Oct 27, 2018
Karabiner complex modification to allow for mouse support in browser in Mac OS
View mac_os_mouse_browser.json
{
"title": "Mac OS Mouse Browser",
"rules": [{
"description": "Use button 4 and 5 on Mac OS for browser",
"manipulators": [{
"type": "basic",
"from": {
"pointing_button": "button4"
},
"to": [{
@SavvyGuard
SavvyGuard / mopubvideoampsample
Last active Aug 29, 2015
sample app mopub videoamp test bidresponse
View mopubvideoampsample
{
"ext": {
"vamp_uuid": "477ce014-c140-11e4-a189-123e43da4f5e"
},
"seatbid": [
{
"bid": [
{
"nurl": "http://vast.videoamp.com/vast/54f4eb6added912e45b3c9b2?price=${AUCTION_PRICE}&vamp_uuid=477ef9da-c140-11e4-a189-123e43da4f5e&ex=mpb&auction_id=${AUCTION_ID}",
"cid": "54f4eb6added912e45b3c9b2",
View samplebidrequest.json
{
"badv": [
"adjghajogh2iohwrgiofhjo.com"
],
"bcat": [
"Automotive",
"Gambling",
"Alcohol"
],
"id": "90f39442f6615a1e1f31e879771b9ef7",
@SavvyGuard
SavvyGuard / createplacement.sh
Last active Aug 29, 2015
create placement in api
View createplacement.sh
curl http://0.0.0.0:3005/placements/api/1.0/create?apikey=pyroturtle -X POST -d '{"impressions": 6000, "geo_region": ["US-CA"], "device__browser": ["Chrome"], "device_os": ["Windows 7", "Windows 8", "Windows 8.1"], "campaign": "54be9b9cdcfad93307ef8b99", "bid": 10}' -H "Content-Type: application/json"
curl http://0.0.0.0:3005/placements/api/1.1/54be9b9cdcfad93307ef8b99/pacing?apikey=pyroturtle -X POST
curl http://0.0.0.0:3005/placements/api/1.1/54be9b9cdcfad93307ef8b99/pacing?apikey=pyroturtle -X PUT -d '{"thursday":{"cap":3000,"0":{"hour_cap":600,"minutes_active":[[0,60]]},"1":{"hour_cap":600,"minutes_active":[[0,60]]},"2":{"hour_cap":600,"minutes_active":[[0,60]]},"3":{"hour_cap":600,"minutes_active":[[0,60]]},"4":{"hour_cap":600,"minutes_active":[[0,60]]},"5":{"hour_cap":600,"minutes_active":[[0,60]]},"6":{"hour_cap":600,"minutes_active":[[0,60]]},"7":{"hour_cap":600,"minutes_active":[[0,60]]},"8":{"hour_cap":600,"minutes_active":[[0,60]]}}}' -H "Cont
@SavvyGuard
SavvyGuard / liverailrequester.py
Created Jan 9, 2015
Makes a bench of requests to liverail test endpoint on bidder for profiling
View liverailrequester.py
import requests
import json
data = {
"bcat": [
"IAB25",
"IAB7-39",
"IAB8-18",
"IAB8-5",
"IAB9-9"
@SavvyGuard
SavvyGuard / dwq.py
Last active Aug 29, 2015
Makes requests to the data warehouse and returns results in json
View dwq.py
# /usr/bin/python
import subprocess
import argparse
import json
import datetime
@SavvyGuard
SavvyGuard / liverailtest.json
Last active Aug 29, 2015
LiveRail Test BidRequest
View liverailtest.json
{
"id": "LR_544697890b8bb5.19955162",
"imp": [
{
"id": "1",
"video": {
"mimes": [
"video/mp4",
"video/x-flv",
"video/webm"
@SavvyGuard
SavvyGuard / pricedecrypt.py
Created Aug 20, 2014
openx price decryption
View pricedecrypt.py
# The incoming encrypted price is unpadded websafe base64 encoded of length 38
# This is obtained from base64 encoding the encrypted price, and *then*
# websafe base64 encoding the already encoded encrypted price.
encrypted_price_base64_wsbase64 = 'SjpvRwAB4kB7jEpgW5IA8p73ew9ic6VZpFsPnA'
# We first add padding
encrypted_price_base64_wsbase64_padded = 'SjpvRwAB4kB7jEpgW5IA8p73ew9ic6VZpFsPnA=='
@SavvyGuard
SavvyGuard / ty_vs_fy_mortgage.py
Last active Aug 29, 2015
mortgage 15 vs 30 year
View ty_vs_fy_mortgage.py
def total_saved(monthly_sum, total_years, ror):
year = 0
total_sum = 0
year_sum = monthly_sum*12
while year <= total_years:
year += 1
total_sum += year_sum
total_sum *= ror
return total_sum
@SavvyGuard
SavvyGuard / ExDict.py
Created Sep 11, 2013
Python dict as a class
View ExDict.py
class ExDict(dict):
"""
Extended Dictionary
"""
def __init__(self,*arg,**kw):
super( ExDict , self).__init__(*arg, **kw)
def __setattr__(self, k, v):
if k in self.keys():
self[k] = v