Skip to content

Instantly share code, notes, and snippets.

Avatar
🥝
Félix with an é

Félix Saparelli passcod

🥝
Félix with an é
View GitHub Profile
View blog.html
---
title: blog
layout: default
advlayout: true
---
<section class="ninecol">
<h1>Latest post: <a href="{{ site.posts.first.href }}">{{ site.posts.first.title }}</a></h1>
</section>
<nav class="threecol last">
View gist:3984651
/* Source: */
String.prototype.color2 = function(fg,bg) {
var conv = function(thing, _default) {
if (+thing < 16 && +thing > -1) { return +thing; }
thing = "white black blue green red brown purple orange yellow lime teal cyan royal pink grey silver".split(" ").indexOf(thing);
if (thing != -1) { return thing; }
return _default;
};
View LOLcryption.js
String.prototype.enlolcrypt2 = function () {
var cipher = "aeoiubcdfghjklmnpqrstvwxyz";
return this.split("").map(function (T) {
var c = /[A-Z]/.test(T), T = T.toLowerCase(), i = cipher.indexOf(T);
if (/[^a-z]/.test(T)) { return T; }
if (/[aeoiu]/.test(T)) {
T = cipher[(i+2)%5];
} else {
T = cipher[(i+5)%21+5];
View gist:3999369
def lolcrypt(str, decrypt = false)
cipher = "aeoiubcdfghjklmnpqrstvwxyz"
str.split("").map { |t|
caps = /[A-Z]/ =~ t
t.downcase!
i = cipher.index t
if /[a-z]/ =~ t
t = cipher[ /[aeoiu]/ =~ t ? (decrypt ? i-2 : i+2)%5 : (decrypt ? i-15 : i+5)%21+5 ]
end
View LOLcryption.js
String.prototype.enlolcrypt = function (cipher) {
cipher = cipher || "aeoiubcdfghjklmnpqrstvwxyz";
return this.split("").map(function (T) {
var c = /[A-Z]/.test(T), T = T.toLowerCase(), i = cipher.indexOf(T);
if (/[^a-z]/.test(T)) { return T; }
if ((new RegExp("["+cipher.substr(0,5)+"]")).test(T)) {
T = cipher[(i+2)%5];
} else {
T = cipher[(i+5)%21+5];
@passcod
passcod / attack
Created Nov 5, 2012
Proposed library functions for xbot
View attack
// Proposed by passcod @ Nov 07 2012 06:47:22
self.attack = function(to) {
var user = to || Object.keys(bot.users)[Math.floor(Object.keys(bot.users).length * Math.random())];
var attack = store.attacks[Math.floor(store.attacks.length * Math.random())];
return attack.replace(/\{defender\}/g, user).replace(/\{attacker\}/g, bot.caller).replace(/{year}/g, Math.round(Math.random() * 10000) + (Math.random() * 100 < 35 ? "BC" : ""));
}
@passcod
passcod / _cleverbot.py
Created Nov 10, 2012
Cleverbot mod for •AZ•BOT•
View _cleverbot.py
#!/usr/bin/python
"""
https://code.google.com/p/pycleverbot
This library lets you open chat session with cleverbot (www.cleverbot.com)
Example of how to use the bindings:
>>> import cleverbot
>>> cb=cleverbot.Session()
>>> print cb.Ask("Hello there")
@passcod
passcod / markov.py
Created Nov 10, 2012
Markov-Chain brain/bot for •AZ•BOT•
View markov.py
"""
Markovbot mod
Depends on:
core mods (>= 1.3.0)
Config options:
markovbot:
# These are good defaults. Change with care.
@passcod
passcod / gist:4057531
Created Nov 12, 2012
Async language? (WIP)
View gist:4057531

I'm thinking about a language concept. Dunno if it already exists or what. Just a random idea. For convenience, let's call it Rall (for Random Async/Lazy Language). For simplicity's sake, I've made the syntax similar to Python or Ruby or CoffeeScript.


In a normal language:

# doA() will run, complete,
# and return.
@passcod
passcod / gist:4129243
Created Nov 22, 2012
xbot nanowrimo sprint module/script
View gist:4129243
# Append to: nanowrime.py
import time
import datetime
from threading import Thread
class nanotimer(Thread):
def set(self, time = 15, func = lambda: 0, *args):
self.time = time * 60
self.func = func