Crystal Source Code:
def factorial(n)
n < 2 ? 1 : n * factorial(n - 1)
end
if ARGV.size > 0
n = ARGV.first.to_u64
puts factorial(n)
declare module "phoenix" { | |
interface Response { | |
status: string, | |
response: any, | |
} | |
interface RecHook { | |
status: any, | |
callback: (response: any) => void |
"""Print a number.""" | |
from __future__ import print_function | |
size_names = [ | |
"", "thousand", "million", "billion", "trillion", "quadrillion", | |
"quintillion", "sexillion", "septillion", "nonillion", "decillion" | |
] | |
num_names = [ |
#!/bin/bash | |
if [ ! -z "$1" -a ! -z "$2" -a ! -z "$3" ]; then | |
psql -c "CREATE USER $1 WITH PASSWORD '$2'" | |
psql -c "CREATE DATABASE $3" | |
psql -c "GRANT ALL PRIVILEGES ON DATABASE $3 to $1" | |
else | |
echo "Usage: new [user] [password] [database]" | |
fi |
#!/usr/bin/env python | |
import random | |
import itertools | |
import os | |
from termcolor import colored | |
def randbool(per=2): | |
"""Get a random boolean value.""" |
export REPO_PATH="$HOME/git" | |
function repo { | |
new_repo="$REPO_PATH/$2" | |
if [ "$1" == "new" -a ! -z "$2" ]; then | |
if [ ! -f "$new_repo" -a ! -d "$new_repo" ]; then | |
mkdir "$new_repo" | |
cd "$new_repo" | |
git init | |
else | |
echo "$new_repo already exists." 1>&2 |
import bs4 as bs | |
import sqlite3 | |
import requests | |
import datetime | |
def db_setup(conn): | |
c = conn.cursor() | |
c.execute("""CREATE TABLE IF NOT EXISTS classes ( | |
subject_code TEXT, |
// Automatically render all elements of type pre.math as latex equations. | |
(function() { | |
var math_elements = document.querySelectorAll('pre.math'); | |
math_elements.forEach(function(e) { | |
e.innerHTML = katex.renderToString(e.innerText); | |
}); | |
})(); |
import numpy as np | |
classifier_config_dict_light = { | |
# Classifiers | |
'sklearn.naive_bayes.GaussianNB': { | |
}, | |
'sklearn.naive_bayes.BernoulliNB': { | |
'alpha': [1e-3, 1e-2, 1e-1, 1., 10., 100.], |
Crystal Source Code:
def factorial(n)
n < 2 ? 1 : n * factorial(n - 1)
end
if ARGV.size > 0
n = ARGV.first.to_u64
puts factorial(n)
import requests | |
from PIL import Image | |
bitmap_width = 1000 | |
bitmap_height = 1000 | |
colours = [ | |
(0xff, 0xff, 0xff), # #FFFFFF | |
(0xe4, 0xe4, 0xe4), # #E4E4E4 | |
(0x88, 0x88, 0x88), # #888888 | |
(0x22, 0x22, 0x22), # #222222 |