Skip to content

Instantly share code, notes, and snippets.

View cvonkleist's full-sized avatar

Christian von Kleist cvonkleist

View GitHub Profile
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char **argv) {
char server[20] = "wwwsearch.bing.com";
int result_count;
char query[20];
char command[100];
char buffer[10000];
#!/usr/bin/env ruby
class Array
def random; self[rand(self.length)]; end
end
# extended by actual player classes
class Player
attr_reader :name
def initialize(name)
# This is a method I use when working with slow ruby scripts that
# operate on huge datasets.
#
# It caches the return value of a block of extremely slow code
# in a file so that subsequent runs are fast.
#
# It's indispensable to me when doing edit-debug-edit-debug-edit
# cycles on giant datasets.
# loads ruby object from a cache file or (if cache file doesn't exist) runs
lockdown:
- change passwords for all shell accounts and come up with policy
- remove ssh authorized_keys
- change mysql root password
- grep for any
- restart mysql with query logging -> mysql --log=/var/log/mysql
- change mysql passwords
-
#!/usr/bin/env ruby
PASS_BIN = 'pass'
SHADOW_FILE = ARGV[0]
lines = File.read(SHADOW_FILE).split("\n")
def generate_password(user)
'houdini!@#' + user
end
#include <unistd.h>
#include <stdio.h>
#include <string.h>
int main(int argc, char **argv) {
char buf[14];
char *pass, *salt;
if(argc < 3) {
printf("usage: %s password salt\n", argv[0]);
return 1;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.DataInputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.net.InetAddress;
import java.net.Socket;
import javax.swing.ImageIcon;
# first, run protocol.rb for a little while to get some match data into gamelog
$ ruby protocol.rb
...later...
# then, run smart.rb (reads gamelog and plays games with the server until it wins)
$ ruby smart.rb
loaded 71 hackers
testing: s.matches_are_sane? = true
getting new hackers
hacker1 will probably defeat hacker2
picking hacker1
@sequence = "L" (1)
i know about 1412 hacker matches
guessing accuracy == 0.00%
checking on last guess and getting new hackers
last guess was good
#!/usr/bin/env ruby
# can be called like this:
#
# spec_run.rb foo.rb
# spec_run.rb foo_spec.rb
# spec_run.rb foo.rb -e "some test case"
ruby_file = "" + ARGV.shift