Skip to content

Instantly share code, notes, and snippets.

View obradovic's full-sized avatar
🏠
Working from home

Zo Obradovic obradovic

🏠
Working from home
View GitHub Profile
@obradovic
obradovic / kasa_plug.py
Last active November 27, 2023 17:28
Kasa plug electrical info
#
# Prints info about Kasa plug electrical usage
#
# USAGE:
# First, make a handy bash alias:
# > alias kasa-plug='python3.10 kasa_plug.py'
#
# See all the plugs:
# > kasa-plug
#
@obradovic
obradovic / README.txt
Created April 4, 2021 13:41
How to set-up a OSX Big Sur VM in VMware Fusion
# from: https://www.huibdijkstra.nl/how-to-set-up-a-osx-mojave-vm-in-vmware-fusion/
# modified for Big Sur
# First, download Big Sur from the App Store. Don't actually install it. Then:
hdiutil create -o /tmp/BigSur.cdr -size 30000m -layout SPUD -fs HFS+J
hdiutil attach /tmp/BigSur.cdr.dmg -noverify -mountpoint /Volumes/install_build
sudo "/Applications/Install macOS Big Sur.app/Contents/Resources/createinstallmedia" --volume /Volumes/install_build
mv /tmp/BigSur.cdr.dmg ~/Desktop/InstallSystem.dmg
hdiutil detach "/Volumes/Install macOS Big Sur"
@obradovic
obradovic / build-ffmpeg-m1.sh
Last active March 24, 2021 13:36
compile ffmpeg on apple silicon
#!/bin/bash
set -exuo pipefail
#
# MODIFIED FROM: https://github.com/ssut/ffmpeg-on-apple-silicon
#
# WILL NEED THE USER TO ENTER ROOT PW
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
@obradovic
obradovic / gist:1b317cb7d26f3dce7b411b790da2edce
Created September 11, 2018 16:32
Sum GCP cost numbers from BigQuery json
cat x.json | jq ".[] | .cost" | tr -d '"' | awk '{ total += $1 } END { print total }'
@obradovic
obradovic / exchange_server_to_google_sheet.py
Last active October 14, 2017 13:08
gets email addresses from an exchange folder and writes them to a google sheet
from datetime import timedelta
from exchangelib import DELEGATE, IMPERSONATION, Account, Credentials, ServiceAccount, \
EWSDateTime, EWSTimeZone, Configuration, NTLM, CalendarItem, Message, \
Mailbox, Attendee, Q, ExtendedProperty, FileAttachment, ItemAttachment, \
HTMLBody, Build, Version
from nameparser import HumanName
def parsename(str):
name = HumanName(str)
return '%s, %s' % (name.last.capitalize(), name.first.capitalize())
tshark -i any -f "dst port 27017" -T fields -e ip.dst -e mongo.full_collection_name -e mongo.database_name
@obradovic
obradovic / imgix_scraper.js
Last active October 9, 2015 13:57
Casper script to scrape imgix billing data for subsequent statsd automation/alerting
var system = require('system');
var casper = require('casper').create({
verbose: false,
logLevel: 'info',
userAgent: 'Mozilla/5.0 poi poi poi (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22',
viewportSize: { width: 1200, height: 600 },
waitTimeout: 20000,
pageSettings: {}
});
@obradovic
obradovic / repos.go
Last active September 9, 2020 15:59
List Github repos on the command line. Suitable for Unixy pipey things
package main
import (
"flag"
"fmt"
"os"
"github.com/google/go-github/github"
"golang.org/x/oauth2"
)
@obradovic
obradovic / terminalspeed
Last active September 12, 2015 14:28
Make OSx terminal cursor move faster
defaults write NSGlobalDomain KeyRepeat -int 0.05
defaults write NSGlobalDomain InitialKeyRepeat -int 12
#!/bin/bash
#
# README
# On OSX please do first:
# brew install coreutils jq
# export GITHUB_ORG="fooproject"
# export GITHUB_REPOS="foo bar baz"
# export GITHUB_USER="your username"
# export GITHUB_PASS="your password"