Skip to content

Instantly share code, notes, and snippets.

@ianlevesque
ianlevesque / mysmartblinds_bridge.py
Last active April 2, 2022 14:42
MySmartBlinds Home Assistant Component
"""
Support for MySmartBlinds Smart Bridge
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/cover.mysmartblinds_bridge
"""
import asyncio
import logging
from contextlib import contextmanager
@ianlevesque
ianlevesque / prouting.sh
Last active February 27, 2018 08:40 — forked from oskar456/prouting.sh
A simple script to set up policy routing on linux. It's stateless and detects everything automatically, so all you have to do is to run it after every network subsystem change. I run it in postup and postdown hooks in Gentoo network configuration file.
#!/bin/bash
IP="/sbin/ip"
function prepare_rt_table() {
local rttables=/etc/iproute2/rt_tables
local iface=$1
[[ "${iface}" = 'lo' ]] && return
if ! egrep -q "\s${iface}\s*"\$ $rttables; then
idx=$(wc -l <$rttables)
@ianlevesque
ianlevesque / pwned.rb
Created February 22, 2018 03:37 — forked from marshallmick007/pwned.rb
Check an entire list of passwords against the Pwned Passwords V2 API
#!/usr/bin/env ruby
require 'io/console'
require 'open-uri'
require 'digest'
IO.foreach("passwords.txt") do |line|
password = line.strip
hash = Digest::SHA1.hexdigest(password).upcase
prefix = hash[0...5]
@ECHO OFF
ECHO Reset Volume Mixer Settings...
NET STOP Audiosrv
NET STOP AudioEndpointBuilder
REG DELETE "HKCU\Software\Microsoft\Internet Explorer\LowRegistry\Audio\PolicyConfig\PropertyStore" /F
REG ADD "HKCU\Software\Microsoft\Internet Explorer\LowRegistry\Audio\PolicyConfig\PropertyStore"
bcdedit /set hypervisorlaunchtype auto
shutdown /r /t 0
bcdedit /set hypervisorlaunchtype off
shutdown /r /t 0
@ianlevesque
ianlevesque / acao-patch.diff
Last active May 16, 2016 23:46
Icecast patch to add CORS header
diff -Naur icecast-kh-icecast-2.3.3-kh10/src/format.c icecast-kh-icecast-2.3.3-kh10-patched/src/format.c
--- icecast-kh-icecast-2.3.3-kh10/src/format.c 2014-02-17 20:46:17.000000000 -0500
+++ icecast-kh-icecast-2.3.3-kh10-patched/src/format.c 2016-05-16 11:33:58.000000000 -0400
@@ -433,6 +433,10 @@
"Expires: Mon, 26 Jul 1997 05:00:00 GMT\r\n");
remaining -= bytes;
ptr += bytes;
+
+ bytes = snprintf (ptr, remaining, "Access-Control-Allow-Origin: *\r\n");
+ remaining -= bytes;
@ianlevesque
ianlevesque / mainDexClasses.bat
Created February 18, 2016 05:38
Fixed version of mainDexClasses.bat to allow Multidex use with Xamarin on Windows.
@echo off
REM Copyright (C) 2013 The Android Open Source Project
REM
REM Licensed under the Apache License, Version 2.0 (the "License");
REM you may not use this file except in compliance with the License.
REM You may obtain a copy of the License at
REM
REM http://www.apache.org/licenses/LICENSE-2.0
REM
REM Unless required by applicable law or agreed to in writing, software

Keybase proof

I hereby claim:

  • I am ianlevesque on github.
  • I am yammering (https://keybase.io/yammering) on keybase.
  • I have a public key whose fingerprint is 1CF5 3850 5210 D0A5 752F 0A0E 35C5 5BD1 92DC 6C80

To claim this, I am signing this object:

var body = String.Join("&", formValues.Select(entry => HttpUtility.UrlEncode(entry.Key) + "=" + HttpUtility.UrlEncode(entry.Value)));
@ianlevesque
ianlevesque / capmon.rb
Created August 31, 2011 21:17 — forked from amscotti/capmon.rb
Ruby script to retrieve and display Comcast data usage. See http://www.128bitstudios.com/2011/08/27/comcast-data-usage-put-a-fork-in-it/
#!/usr/bin/env ruby
require 'rubygems'
require 'mechanize'
URL_PRELOADER = 'https://customer.comcast.com/Secure/Preload.aspx?backTo=%2fSecure%2fUsers.aspx&preload=true'
URL_USERS = 'https://customer.comcast.com/Secure/Users.aspx'
URL_ACCOUNT = 'https://customer.comcast.com/Secure/Account.aspx'
abort "Usage: #{$0} <username> <password>" unless ARGV.length == 2