Skip to content

Instantly share code, notes, and snippets.

@DamianZaremba
DamianZaremba / syntax.py
Created December 20, 2009 21:59 — forked from sarahhodne/syntax.c
Playing with ruby vs other langs
if 2 + 2 == 4:
print "OHAI"
else:
print "WTF"
@DamianZaremba
DamianZaremba / cPanel Hook output
Created November 3, 2010 10:37
cPanel hook output
ADD DNS
Cpanel::Config::LoadCpUserFile::load('system') called at /usr/local/cpanel/Cpanel/Config/LoadCpUserFile.pm line 158
Cpanel::Config::LoadCpUserFile::loadcpuserfile('system') called at /usr/local/cpanel/Cpanel/Config/ModCpUserFile.pm line 26
Cpanel::Config::ModCpUserFile::adddomaintouser('user', 'system', 'domain', 'test.damian.internal', 'type', '') called at /usr/local/cpanel/Cpanel/DnsUtils.pm line 446
Cpanel::DnsUtils::doadddns('domain', 'test.damian.internal', 'ip', '127.0.0.1', 'reseller', 'root', 'trueowner', 'system') called at whostmgr/bin/whostmgr line 3197
main::adddns() called at whostmgr/bin/whostmgr line 669
EDIT OPEN
main::getzonelocal() called at whostmgr/bin/dnsadmin-ssl line 339
Testing a gist from perl
import logging
import logging.handlers
log_format = logging.Formatter("[%(asctime)s] [%(name)1s - %(threadName)s] %(levelname)-1s %(message)s", datefmt = '%d/%m/%Y %I:%M:%S')
# Log files
queue_file = "queue.log"
deamon_file = "deamon.log"
server_access_file = "server_access.log"
server_error_file = "server_error.log"
$file = "Ohhai.json";
$stuff = array();
if(is_file($file) && is_readable($file)) {
$stuff = json_decode(file_get_contents($file));
if(!$stuff) {
die("Could not parse file");
}
} else {
die("Cannot read file");
}
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
void main () {
char[] queue_dir = "/home/damian/test/%s";
char *file_name = get_filename();
char file_path[strlen(queue_dir) + strlen(file_name)];
sprintf(file_path, queue_dir, file_name);
diff -r cluebotng_changes/reportinterface/includes/header.php cluebotng/reportinterface/includes/header.php
7d6
< require_once 'includes/recaptchalib.php';
22c21
< ?>
---
> ?>
\ No newline at end of file
Only in cluebotng_changes/reportinterface/includes: recaptchalib.php
diff -r cluebotng_changes/reportinterface/includes/settings.php cluebotng/reportinterface/includes/settings.php
def gen_rand_str()
return (0...20).map{
('a'..'z').to_a[rand(26)] +
('A'..'Z').to_a[rand(26)] +
('0'..'9').to_a[rand(10)]
}.join
end
puts gen_rand_str()
@DamianZaremba
DamianZaremba / get_xckd.pl
Created May 20, 2011 16:03
Random perl hack for getting new xckd images....
#!/usr/bin/env perl
use strict;
use LWP::Simple;
use Data::Dumper;
my $dump_folder = '/home/damian/Pictures/xckd';
my $base_perm_url = 'http://xkcd.com';
my $base_image_url = 'http://imgs.xkcd.com/comics';
sub get_cid {
import re
'''
I stoled these from http://stackoverflow.com/questions/319279/how-to-validate-ip-address-in-python
'''
def is_valid_ipv4(ip):
"""Validates IPv4 addresses.
"""
pattern = re.compile(r"""
^