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 traceback | |
import sys | |
from functools import lru_cache | |
from web3 import Web3 | |
from web3.auto import w3 | |
from web3.contract import Contract | |
from web3._utils.events import get_event_data | |
from web3._utils.abi import exclude_indexed_event_inputs, get_abi_input_names, get_indexed_event_inputs, normalize_event_input_types | |
from web3.exceptions import MismatchedABI, LogTopicError | |
from web3.types import ABIEvent |
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 -e | |
if [ -z "$NAMESPACES" ]; then | |
NAMESPACES=$(kubectl get ns -o jsonpath={.items[*].metadata.name}) | |
fi | |
RESOURCETYPES="${RESOURCETYPES:-"ingress deployment configmap svc rc ds networkpolicy statefulset cronjob pvc"}" | |
GLOBALRESOURCES="${GLOBALRESOURCES:-"namespace storageclass clusterrole clusterrolebinding customresourcedefinition"}" | |
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
# Run using "sudo accept_xcode_license.sh" | |
# | |
# Solving the OSX Yosemite Xcode Command Line Tools Licensing problem | |
# for multiple updates in order to script post-install tasks. | |
# Typical error reads after running "xcode-select --install" when setting up | |
# Homebrew is: "Agreeing to the Xcode/iOS license requires admin priviledges, | |
# please re-run as root via sudo" | |
# | |
# CREDIT: | |
# Based on a tip found at http://krypted.com/mac-os-x/licensing-the-xcode-command-line-tools/ |
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
exceptions = [] | |
tree = {} | |
ObjectSpace.each_object(Class) do |cls| | |
next unless cls.ancestors.include? Exception | |
next if exceptions.include? cls | |
next if cls.superclass == SystemCallError # avoid dumping Errno's | |
exceptions << cls | |
cls.ancestors.delete_if {|e| [Object, Kernel].include? e }.reverse.inject(tree) {|memo,cls| memo[cls] ||= {}} | |
end |
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 | |
if [ $# -eq 0 ] | |
then | |
echo "tessdata.sh LANG [TAG]" | |
echo "check LANG and TAG from https://github.com/tesseract-ocr/tessdata/" | |
fi | |
BRANCH=master | |
if [ $# -eq 2 ] | |
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
# Add these methods to your ApplicationController. Then, any controller | |
# that inherits from it will have these methods and can programmatically | |
# determine what filters it has set. | |
class ApplicationController < ActionController::Base | |
def self.filters(kind = nil) | |
all_filters = _process_action_callbacks | |
all_filters = all_filters.select{|f| f.kind == kind} if kind | |
all_filters.map(&:filter) | |
end |
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
[repositories] | |
local | |
oschina: http://maven.oschina.net/content/groups/public/ | |
oschina-ivy: http://maven.oschina.net/content/groups/public/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext] | |
typesafe: http://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly | |
#sonatype-oss-releases | |
#maven-central | |
#sonatype-oss-snapshots |
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 BSTree | |
attr_accessor :left, :right, :parent, :value | |
def initialize(value, parent = nil) | |
@value = value | |
@parent = parent | |
end | |
def self.build_by_array(array, parent = nil) | |
return nil unless array |
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 APIProfiler | |
def initialize(app, config = {}) | |
@app = app | |
# default print out log to STDOUT, otherwise you can inject rails logger | |
@config = config | |
@config[:logger] = Logger.new(STDOUT) unless config[:logger] | |
@config[:log_level] = :info unless config[:logger_level] | |
@config[:filter] = lambda { false } unless config[:filter] #turn off by default | |
end | |
=begin |
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 | |
# watchdo "rake" .rb | |
command="$1" | |
shift | |
fileSpec="$@" | |
sentinel=/tmp/t.$$ | |
touch -t197001010000 $sentinel |
NewerOlder