Skip to content

Instantly share code, notes, and snippets.

View jyotty's full-sized avatar

Joshua Yotty jyotty

View GitHub Profile
@jyotty
jyotty / viewport.scpt
Created August 3, 2011 00:05
"It's great but the viewport in this window needs to be scrolled partially" "Ok"
tell application "System Events"
tell application "Safari" to activate
delay 0.5
repeat 2 times
key code 124
delay 0.5
end repeat
repeat 4 times
key code 125
delay 0.5
@jyotty
jyotty / chkwebscripts.sh
Created July 16, 2011 00:18
Abomination v. abominations
find -sx /home/ -type f \
\( -iname '*.php' -or -perm -u+x -or -perm -g+x -or -perm -o+x \) \
-exec ls -liTd \{\} \+ |
check_diff new_only chkwebscripts - "${host} new or modified PHP/CGI scripts:" |
perl -l0 -ne 'print $1 if m{(/home.*?)$}' | xargs -0 clamscan
require File.expand_path(File.dirname(__FILE__) + '/edgecase')
# Project: Create a Proxy Class
#
# In this assignment, create a proxy class (one is started for you
# below). You should be able to initialize the proxy object with any
# object. Any messages sent to the proxy object should be forwarded
# to the target object. As each message is sent, the proxy should
# record the name of the method send.
#
$ pbpaste | perl -Minteger -pe'1 while s!(?:\(\s*(?:\d+\s*[\+\-\*/]\s*)+\d+\s*\))|(?:\d+\s*[\+\-\*/]\s*)+\d+!$&!ee'
8
6
16
47
57
64
39
@jyotty
jyotty / eph.js
Created May 10, 2011 01:56
I can get used to this
for (var i = 0; i < unfiltered.length; i++) {
if (unfiltered[i].host in config.hosts &&
unfiltered[i].type_instance in config.hosts[unfiltered[i].host].type_instance) {
filtered.push(unfiltered[i]);
}
}
PreCacheChain "PreCache"
PostCacheChain "PostCache”
<Chain "PreCache">
<Rule "send_iface_to_node">
<Match "regex">
Plugin "^interface$"
Type "^if_octets$"
</Match>
<Target "write">
use IO::Pipeline;
use Data::Dump qw(dump);
sub ptap (;&) { my $tap = shift || sub { print }; return pgrep { $tap->(); 1 } }
my $source = <<'END';
2010-03-21 16:15:30 1NtNoI-000658-6V Completed
2010-03-21 16:17:29 1NtNlx-00062B-0R Completed
2010-03-21 16:20:37 1NtNtF-0006AE-G6 Completed
2010-03-21 16:28:37 no host name found for IP address 218.108.42.254
#!/usr/bin/env perl
use strict;
use integer;
use feature ':5.10';
my $quoted_field = qr/"(?>(?:(?>[^"\\]+)|\\.)*)"/;
my $parse_combined = qr/^
(?<ip>\S+) \s+ # IP address
(?<ident>\S+) \s+ # Ident
$ ./configure --prefix=/usr/local/collectd --without-included-ltdl
checking build system type... i386-unknown-freebsd7.2
checking host system type... i386-unknown-freebsd7.2
checking for gcc... gcc
blah blah blah
checking whether libtool supports -dlopen/-dlpreopen... yes
checking for ltdl.h... no
checking where to find libltdl headers... -I${top_srcdir}/libltdl
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.collectd.collectd</string>
<key>ProgramArguments</key>
<array>
<string>/opt/collectd/sbin/collectd</string>
<string>-f</string>