Skip to content

Instantly share code, notes, and snippets.

View jtzero's full-sized avatar
👾

Kyle Behrens jtzero

👾
View GitHub Profile
def const_source_location(const)
if method_name = const.instance_methods.sort.find {|m| const.instance_method(m).owner == const }
const.instance_method(method_name).source_location
else
raise "`#{const}' has no uninherited/mixed in instance methods"
end
end

pre 0.9.0

shell# echo '
[sshd]
enabled = true
filter = sshd
action = iptables-multiport
logpath = /var/log/auth.log
maxretry = 3

cd ~/Downloads

wget http://repo.zabbix.com/zabbix/3.2/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.2-1+xenial_all.deb

dpkg -i zabbix-release_3.2-1+xenial_all.deb

apt-get update

should add /etc/apt/sources.list.d/zabbix.list

@jtzero
jtzero / gist:7456626
Created November 13, 2013 21:22
@metajack's post saved from codexon Category: Internet, Programming, Python The recent server benchmark posted here comparing Erlang, Haskell, and Python understandably upset many people. Today we will move away from polarizing benchmarks and more about features. Even though Erlang may not be the fastest language, it still has at least one grea…
import os
import time
import socket
import sys
import fcntl
import _multiprocessing
from multiprocessing import Pipe
# global pipe variable
pipe = None
@jtzero
jtzero / ruby.nanorc
Last active March 7, 2019 06:23
a better ruby.nanorc /usr/share/nano/ruby.nanorc
## Here is an example for Ruby.
##
syntax "ruby" "(Gemfile|Rakefile|\.(rb|rake|gemspec|ru|simplecov))$"
header "^#!.*(env\s|\/)ruby[-0-9._]*"
## Asciibetical list of reserved words
color yellow "\<(BEGIN|END|alias|and|begin|break|case|class|def|defined\?|do|else|elsif|end|ensure|false|for|if|in|lambda|module|next|nil|not|or|redo|rescue|retry|return|self|super|then|true|undef|unless|until|when|while|yield)\>"
## Constants
color brightblue "(\$|@|@@)?\<[A-Z]+[0-9A-Z_a-z]*"
@jtzero
jtzero / unc_path.rb
Created October 3, 2012 16:21
Ruby realpath returns the unc path if available for mapped drive
# * *author* : jtzero
# * *version* : 1.2.3
# * *description* : returns the unc path of a file when using realdir
#
require 'win32api'
class IO
WNetGetConnection = begin
Win32API.new("mpr.dll", "WNetGetConnection", ['P','P','P'], 'L')
rescue #if not windows just return 0
lambda {|locate, remote, size| remote = local; next 0 }