Skip to content

Instantly share code, notes, and snippets.

This was a bit of a trick to get set up, so here it is for anyone who comes across it in search results.

ZNC User Account

  • Set up the account as usual (note the username and password)
  • Set the defualt buffer size to 0. Every time the bot reconnects after a crash, it would try to respond to the commands it hear or respond in the buffer, and might crash it again.
  • Go ahead and define a network and channel for your bot. Note the network name.
  • You should now see a "ghost" for your hubot connected.
  • Look at the ZNC user list. The hubot user will show 1 network, but 0 clients.
#!/usr/bin/perl -w
use strict;
use Socket;
use IO::Handle;
if($#ARGV+1 != 2){
print "$#ARGV $0 Remote_IP Remote_Port \n";
exit 1;
}
@lancelakey
lancelakey / gist:39f19cf1da3a867db1be
Created May 7, 2014 07:24
#dtrace how do I got sucj privileges?
[00:59:32] nanxiao: Hi, everyone. A guy has posted a issue about DTrace:http://www.listbox.com/member/archive/184261/2014/05/sort/time/page/1/entry/0:2/20140504234521:8955DE22-D407-11E3-ABB7-E7A856EF6811/.
[00:59:33] nanxiao: Could anyone help and give some advices on it?
[00:29:06] seanmcg: nanxiao, reduce the number of probes, this one you have; "fbt:::" can match over 90,000 probes.. (94415 on my desktop for example)
[00:47:32] nanxiao: seanmcg: Yes. But the root cause seems the dynamic variables leaks. Dave has answered the question:http://www.listbox.com/member/archive/184261/2014/05/sort/time/page/1/entry/2:3/20140505141710:5BA4F4A2-D481-11E3-ADF7-F8194C58CA13/
[00:47:51] Welastevil: hi everyone!
[00:47:54] Welastevil: someone here???
[00:49:12] nanxiao: seanmcg: Because I am the owner of the question, only help to forward this issue, I don't know whether the issue has been resolved. I can ask the owner of the new progress.:) Thanks for your kindly notice!
[00:50:53] nanxiao: seanmcg: B
T 10.118.139.238:40645 -> 10.218.136.203:81 [AP]
GET /api/v4/search HTTP/1.1.
User-Agent: Dalvik/1.6.0 (Linux; U; Android 4.1.2; LG-P659 Build/JZO54K).
Host: api.example.com.
Accept-Encoding: gzip.
X-Forwarded-Proto: https.
X-Forwarded-Port: 443.
X-Forwarded-For: 172.26.13.18.
Connection: close.
X-Forwarded-Proto: http.
@lancelakey
lancelakey / playing_with_bash.txt
Last active August 29, 2015 13:57
Playing with bash in the Mac OS X Terminal
This is not a script
Simply type the stuff next to the ~ > into your Terminal like I did
Basically, we're playing around with doing a thing, and then with doing a thing several times
Play around with this for a few minutes, have fun with it, see if you can come up with your own variations
Homework, things to think about:
What does echo do?
What does for do?
What is {1..5}?
What does for i in {1..5} ; do SOMETHING ; done do?
@lancelakey
lancelakey / install_es.sh
Created September 19, 2013 22:29
Install ElasticSearch on CentOS 6
#!/usr/bin/env bash
set -x
# Install ES
pushd /tmp/
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.5.noarch.rpm
yum install -y elasticsearch-0.90.5.noarch.rpm
popd
## This does not work:
execute "rake update" do
cwd "/tmp/"
command "rake update"
end
## From the log:
execute("rake update") do
action "run"
retries 0
@lancelakey
lancelakey / gist:6549082
Created September 13, 2013 10:34
redis configuration
daemonize yes
pidfile /var/run/redis/6379/redis_6379.pid
port 6379
timeout 0
loglevel notice
syslog-enabled yes
syslog-ident redis-6379
syslog-facility local0
databases 16
save 900 1
@lancelakey
lancelakey / berkshelf_upload_all_the_berks.rb
Created July 16, 2013 06:13
Upload all Berkshelf dependencies in all subdirectories to a Chef server.
#!/usr/bin/env ruby
require 'pathname'
require 'pp'
Dir.glob("**/Berksfile") do |bf|
bd = Pathname.new("#{bf}").dirname.to_path
result = %x( cd #{bd} ; berks upload )
@lancelakey
lancelakey / gist:5953926
Created July 9, 2013 01:28
Vagrant and ssh-agent forwarding

Vagrant and ssh-agent forwarding

I wanted some of my Vagrant instances to be able to git clone private repositories without having to store any ssh keys in any cookbooks, repositories, etc.

This is a dirty hack but it works better than anything else I've found so far.

Vagrant.configure("2") do |config|
  config.vm.hostname = "example"