This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -u | |
set -e | |
LINK_ONLY=0 | |
BUILD_OK=0 | |
MINERA_PATH="/var/www/minera" | |
BINARY_PATH="$MINERA_PATH/minera-bin" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MultiRange: | |
def __init__(self, range_str, **kwargs): | |
""" | |
MultiRange return a complex number sequence from a formatted string. | |
Range formats: | |
'Start[:Stop[:Step]]' - Start number (or single number), stop number (optional), step value (optional) | |
Groups are separated by ','. | |
For example, `MultiRange('1:3,5,7:9')` will result in (1,2,3,5,7,8,9). | |
Text substitution can be specified by adding a keyword argument of the same name. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This module is a modified version of a code sample from | |
http://wiki.wxpython.org/Combo%20Box%20that%20Suggests%20Options | |
""" | |
import wx | |
class CBEvent(object): | |
normal = 0 | |
ignore = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import signal | |
import time | |
import threading | |
import BaseHTTPServer | |
import SimpleHTTPServer | |
start = time.time() | |
run_time = 60 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import functools | |
import re | |
class LdapNotationParser(object): | |
def __init__(self, parse_str, arg1_fn=None, arg2_fn=None): | |
""" | |
Parse and process LDAP search filter statement conditional arguments. | |
Optional functions can be applied to either argument in the statement. | |
Example usage: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CsvReaderWrapper(object): | |
def __init__(self, csv_file, **kwargs): | |
self._csv_file = csv_file | |
self._reader = csv.reader(csv_file, **kwargs) | |
def __len__(self): | |
pos = self._csv_file.tell() | |
self._csv_file.seek(0) | |
items = 0 | |
for items, _ in enumerate(self._reader): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 1. Create a new generic password entry in Keychain Access called "WHATEVER_AnyConnect_VPN" (the name in Keychain access must match that in line 39 below) with your password for the Cisco AnyConnect VPN server. | |
-- 2. Open this script in Script Editor (both this and the above are in the Applications->Utilities folder) and "Save as.." an Application (.app) with desired name. | |
-- 3. Open Security & Privacy System Preferences, go to Privacy, Accessibility. | |
-- 4. Enable the above .app so it can access Accessibility | |
-- 5. Copy and paste a nice icon on the generic Applescript icon (I used a copy of the default AnyConnect one) | |
-- 6. Add the new .app to /Users/[yourshortname]/Applications with a shortcut to your Dock | |
-- 7. Enjoy the fast connection with no need to enter password and increased security of not having a sensitive password stored as plain text | |
-- 8. Run script again to close connection | |
-- AnyConnect now refered to as targetApp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Cisco Anyconnect CSD wrapper for OpenConnect | |
# Requirements: | |
# - wget (brew install wget) | |
# - md5sum (brew install md5sha1sum) | |
# Enter your vpn host here | |
#CSD_HOSTNAME= | |
if [[ -z ${CSD_HOSTNAME} ]] | |
then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible). | |
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export. | |
var FORMAT_ONELINE = 'One-line'; | |
var FORMAT_MULTILINE = 'Multi-line'; | |
var FORMAT_PRETTY = 'Pretty'; | |
var LANGUAGE_JS = 'JavaScript'; | |
var LANGUAGE_PYTHON = 'Python'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blueprint: | |
name: No Motion - Light Off | |
description: Turn off a light when no motion is detected. | |
domain: automation | |
source_url: https://gist.github.com/brettvitaz/223151868704e40ddac8023df06be7f0 | |
input: | |
motion_entity: | |
name: Motion Sensor | |
selector: | |
entity: |
OlderNewer