Skip to content

Instantly share code, notes, and snippets.

View cvonkleist's full-sized avatar

Christian von Kleist cvonkleist

View GitHub Profile
def vxworks_sum(plaintext)
int = 0
0.upto(plaintext.length - 1) do |i|
int += plaintext[i] * (i + 1) ^ (i + 1)
end
int
end
def sum_to_pw(int)
out = "%u" % ((int * 31695317) & 0xffffffff)
out.bytes.each_with_index do |b, i|
out[i] += '!'[0] if out[i] < '3'[0]
out[i] += '/'[0] if out[i] < '7'[0]
out[i] += 'B'[0] if out[i] < '9'[0]
end
out
end
def vxworks_sum_to_pw(int)
out = "%u" % ((int * 31695317) & 0xffffffff)
out.bytes.each_with_index do |b, i|
out[i] += '!'[0] if out[i] < '3'[0]
out[i] += '/'[0] if out[i] < '7'[0]
out[i] += 'B'[0] if out[i] < '9'[0]
end
out
end
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <openssl/evp.h>
<?php
require "inc/mysql.inc.php";
?>
<html>
<head><title>Oh, Those Admins!</title></head>
<body><center><h1>Oh, hi!</h1>
<?php
if (isset($_GET['password'])) {
$r = mysql_query("SELECT login FROM admins WHERE password = '" . md5($_GET['password'], true) . "'");
if (mysql_num_rows($r) < 1)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <openssl/evp.h>
// compile with: gcc -lssl find.c
escape ^]]
startup_message off
defflow auto
defscrollback 5000
altscreen on
autodetach on
msgwait 3
#change the hardstatus settings to give an window list at the bottom of the
#screen, with the time and date and with the current window highlighted
@cvonkleist
cvonkleist / gist:704188
Created November 17, 2010 22:04
forking retarded web server
require 'socket'
listener = TCPServer.new(8888)
loop do
puts 'waiting for connection...'
sock = listener.accept
fork do
puts 'i am child'
filename = sock.gets.split[1]
begin
@cvonkleist
cvonkleist / irbrc.rb
Created January 7, 2011 17:04
easy way to preview html in a variable
# put this in ~/.irbrc
def h(html)
File.open('/tmp/irb.html', 'w') { |f| f.write html }
`chromium /tmp/irb.html`
end
Example:
% irb
@cvonkleist
cvonkleist / cvk.zsh-theme
Created January 7, 2011 17:11
modification of jreese
# ripoff of jreese.zsh-theme
if [ "$(whoami)" = "root" ]; then NCOLOR="red"; fi
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
PROMPT='%m \
$(git_prompt_info)\
%(!.#.%%) '
#PROMPT='%{%{$fg[green]%}%m%{$reset_color%} \
#$(git_prompt_info)\