Skip to content

Instantly share code, notes, and snippets.

View Caaz's full-sized avatar

Daniel Cavazos Caaz

View GitHub Profile
@Caaz
Caaz / media.pl
Created March 11, 2015 19:41
Manual media organization.
#!/usr/bin/perl
use warnings;
use strict;
use File::Copy;
my ($resolution,$series,$episodePad,$seasonPad);
input("Resolution",\$resolution,0);
input("Series title",\$series,0);
input("Episode Padding",\$episodePad,2);
input("Season Padding",\$seasonPad,2);
my @files = <"./*$series*">;
my %last = ();
for('Channel Message', 'Private Message to Dialog', 'Your Message') { hook_print($_,\&handle_text,{'data'=>[$_]}); }
for('Channel Msg Hilight','Channel Action','Join','Quit','Part') { hook_print($_,\&reset_last); }
sub reset_last {
my $where = get_info('channel');
delete $last{$where};
return EAT_NONE;
}
sub handle_text {
my ($event,$where,$nick,$msg) = ($_[1][0],get_info('channel'),@{$_[0]});
@Caaz
Caaz / main.pl
Created January 2, 2016 19:56
An obfuscated poll bot
#!/usr/bin/perl
use warnings;
use strict;
use IO::Socket;
my %c = (
prefix => '\!',
server => 'localhost',
channel => '#TheFusion',
admin => 'Megurine',
nick => 'Poli',
@Caaz
Caaz / slider.js
Created January 5, 2016 17:14
Slider fix
var sliderIndex = 0;
var refreshIntervalId;
var $images = $(".slide-group").children();
$(function(){
var $bar = $('.slide-buttons');
addButton("Previous", prev, $bar);
addButton("Next", next, $bar);
})
@Caaz
Caaz / compile-sass.pl
Created January 24, 2016 12:10
SCSS Compiler!
#!/usr/bin/perl
use warnings;
use strict;
my %updated;
sub compile_scss {
# Get our list of files
my @files = <./scss/*.scss>;
# Do nothing if there aren't even any files
return 0 if(!@files);
# Make sure we even have sass available to us.
@Caaz
Caaz / bot.pl
Created January 24, 2016 12:11
A simple as hell perl bot
#!/usr/bin/perl
use warnings;
use strict;
use IO::Socket;
my %config = (prefix => '\!', server => 'localhost', channel => '#TheFusion', nick => 'Poli');
sub sendServer { my $socket = shift; print $socket "$_\n" for(@_); }
sub connectServer {
my ($host,$port) = split /\:/, $config{server};
my $socket = new IO::Socket::INET(PeerAddr=>$host, PeerPort=>($port)?$port:6667);
die "Can't connect: $host $port" if($@);
@Caaz
Caaz / test.dart
Created March 12, 2016 04:10
Test server
import "dart:io";
void main() {
startServer(InternetAddress.ANY_IP_V4,3333);
}
void startServer(host, int port) {
HttpServer
// HttpServer object
.bind(host,port)
// bind returns a Future<HttpServer> object. Future objects have the method then, which is called when it's child type is ready.
.then((HttpServer server) {
System: Host: Oozlum Kernel: 4.4.0-53-generic x86_64 (64 bit gcc: 5.4.0)
Desktop: Cinnamon 3.2.7 (Gtk 3.18.9-1ubuntu3.1) Distro: Linux Mint 18.1 Serena
Machine: System: Hewlett-Packard (portable) product: HP ENVY 17 Notebook PC v: 0884100000305B00000620100
Mobo: Hewlett-Packard model: 1966 v: KBC Version 93.51 Bios: Insyde v: F.56 date: 04/23/2014
CPU: Quad core Intel Core i7-4700MQ (-HT-MCP-) cache: 6144 KB
flags: (lm nx sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx) bmips: 19156
clock speeds: max: 3400 MHz 1: 2400 MHz 2: 2400 MHz 3: 2779 MHz 4: 2422 MHz 5: 2400 MHz 6: 2400 MHz
7: 2400 MHz 8: 2401 MHz
Graphics: Card-1: Intel 4th Gen Core Processor Integrated Graphics Controller bus-ID: 00:02.0
Card-2: NVIDIA GK208M [GeForce GT 740M] bus-ID: 01:00.0
inxi -Fxz
System: Host: Oozlum Kernel: 4.4.0-53-generic x86_64 (64 bit gcc: 5.4.0)
Desktop: Cinnamon 3.2.7 (Gtk 3.18.9-1ubuntu3.1)
Distro: Linux Mint 18.1 Serena
Machine: System: Hewlett-Packard product: HP ENVY 17 Notebook PC v: 0884100000305B00000620100
Mobo: Hewlett-Packard model: 1966 v: KBC Version 93.51
Bios: Insyde v: F.56 date: 04/23/2014
CPU: Quad core Intel Core i7-4700MQ (-HT-MCP-) cache: 6144 KB
flags: (lm nx sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx) bmips: 19154
clock speeds: max: 3400 MHz 1: 2832 MHz 2: 2928 MHz 3: 2413 MHz
@Caaz
Caaz / Neko.java
Created February 6, 2017 17:04
A robocode bot.
package bitdev;
import robocode.*;
import java.awt.Color;
// Neko - a robot by Caaz
public class Neko extends AdvancedRobot {
private boolean direction = true;
public void run() {
setColors(Color.black, Color.black, Color.white);
while(true) {