Skip to content

Instantly share code, notes, and snippets.

View sashkab's full-sized avatar

Aleks Bunin sashkab

View GitHub Profile
@jasonsnell
jasonsnell / enphase_average.5m.py
Last active November 18, 2024 04:12
Enphase Envoy Local Data - SwiftBar/xBar Menu Bar Script
#! /usr/bin/env python3
# This script is explained here: <https://sixcolors.com/post/2024/10/putting-my-solar-system-in-my-menu-bar/>
# Adapted from [email protected] <https://github.com/grzegorz914/homebridge-enphase-envoy>
# <xbar.title>Enphase Solar (Averages)</bitbar.title>
# <xbar.version>v1.2</xbar.version>
# <xbar.author>Jason Snell</xbar.author>
# <xbar.author.github>jasonsnell</xbar.author.github>
# <xbar.desc>Display local Enphase solar stats.</xbar.desc>
@gruber
gruber / Split Tabs to New Window.scpt
Last active May 5, 2024 16:58
An AppleScript for Safari to move all tabs in the frontmost window, from the current tab to the rightmost (last) tab, to a new window.
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
(*
Original script: John Gruber (https://daringfireball.net/linked/2023/12/05/an-applescript-for-safari-split-tabs-to-new-window)
Much more elegant version: Leon Cowle (https://github.com/leoncowle)
Even more elegant version: https://stackoverflow.com/questions/54066100/applescript-to-split-safari-tabs-into-new-window/54089865#54089865
Worth a warning: "moving" tabs with this script doesn't actually move them like
drag-and-drop does. The tabs "moved" by this script will reload in the new window,
@koleson
koleson / Future_Experiments.md
Last active October 31, 2024 02:40
PVS6 Notes

Past and Future Experiments

Ideas for profitable investigations and an index of experimental results. Free to a good home; will post results as they come in.

Past Experiments

MQTT reroute - MQTT_Reroute.md

Very fruitful - finally understood how the mySunPower app's SunVault mode changes are communicated to the PVS6, which performs the system control described by the modes, and found a potential method of changing the command and data acquisition server from one in the cloud to one that is locally controlled.

Future Experiments

#!/usr/bin/env bash
# many settings from https://raw.githubusercontent.com/mathiasbynens/dotfiles/master/.macos
# many settings from https://raw.githubusercontent.com/thoughtbot/laptop/master/mac
# instructions on finding the default you've changed: https://pawelgrzybek.com/change-macos-user-preferences-via-command-line/
# previous install notes at:
# https://gist.github.com/llimllib/ee591266e05bd880629a4e7511a61bb3
# https://gist.github.com/llimllib/e864a92da94ceb1ef0da2e06fd1f8d70
# https://gist.github.com/llimllib/aa4420cac617774ee2a54d8603d862e4
fancy_echo() {
@ctsrc
ctsrc / README.md
Last active September 11, 2024 19:51 — forked from niw/README.en.md
Guide: Run FreeBSD 13.1-RELEASE for ARM64 in QEMU on Apple Silicon Mac (MacBook Pro M1, etc) with HVF acceleration (Hypervisor.framework)
@pletch
pletch / scrape_pfsense_dhcp_leases.py
Last active April 12, 2024 03:02
Scrape PFSense DHCP Leases Status Page and Export Results to JSON
#!/usr/bin/env python3
# # This python script provides a function to query the pfsense (+v2.4) dhcp leases status page and return a list of tuples including
# ip, hostname, and mac address. To use, ensure LXML is installed via package manager or via pip.
#
# 16-Dec-2016 - Original release
# 3-Sep-2020 - Minor update to match formatting of leases page in latest pfSense version (2.4.5).
# 9-Sep-2020 - Backported improvements to handle table rows with missing data, use global variables for user/pass/server_ip,
# and return list from scrape function as implemented by fryguy04 in fork here:
# https://gist.github.com/fryguy04/7d12b789260c47c571f42e5bc733a813

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

@pudquick
pudquick / diskman.py
Last active December 14, 2022 17:03
Light pyobjc wrapper around the PrivateFramework DiskManagement.framework for direct access to disk devices and information about them
import objc
from Foundation import NSBundle
# Predefine some opaque types
DASessionRef = objc.createOpaquePointerType('DASessionRef', b'^{__DASession=}', None)
DADiskRef = objc.createOpaquePointerType('DADiskRef', b'^{__DADisk=}', None)
# Load DiskManagement framework classes
DiskManagment = objc.loadBundle('DiskManagment', globals(), bundle_path='/System/Library/PrivateFrameworks/DiskManagement.framework')
@varemenos
varemenos / 1.README.md
Last active October 23, 2024 13:07
Git log in JSON format

Get Git log in JSON format

git log --pretty=format:'{%n  "commit": "%H",%n  "abbreviated_commit": "%h",%n  "tree": "%T",%n  "abbreviated_tree": "%t",%n  "parent": "%P",%n  "abbreviated_parent": "%p",%n  "refs": "%D",%n  "encoding": "%e",%n  "subject": "%s",%n  "sanitized_subject_line": "%f",%n  "body": "%b",%n  "commit_notes": "%N",%n  "verification_flag": "%G?",%n  "signer": "%GS",%n  "signer_key": "%GK",%n  "author": {%n    "name": "%aN",%n    "email": "%aE",%n    "date": "%aD"%n  },%n  "commiter": {%n    "name": "%cN",%n    "email": "%cE",%n    "date": "%cD"%n  }%n},'

The only information that aren't fetched are:

  • %B: raw body (unwrapped subject and body)
  • %GG: raw verification message from GPG for a signed commit
@ghtdak
ghtdak / attributes
Last active August 29, 2015 14:06
IPython Notebook Git revision control with Pre-commit hook, Netcat and Python Daemon
# This goes in .git/info
*.ipynb filter=dropoutput_ipynb