Skip to content

Instantly share code, notes, and snippets.

@tskrynnyk
tskrynnyk / dancr.pl
Created February 22, 2012 21:39 — forked from sukria/dancr.pl
tutorial : a complete dancer app
use Dancer;
use DBI;
use File::Spec;
use File::Slurp;
use Template;
set 'database' => File::Spec->tmpdir() . '/dancr.db';
set 'session' => 'Simple';
set 'template' => 'template_toolkit';
set 'logger' => 'console';
@tskrynnyk
tskrynnyk / grep-tar-gz.sh
Created March 7, 2012 11:45
Grep through compressed archives
#! /bin/bash
[ "$#" -ne 2 ] && exit 1
tar -tf "$2" | grep -v '/$' \
| while read file
do tar -Ozxf "$2" "$file" | grep "$1" && echo $file
done
@tskrynnyk
tskrynnyk / change-the-collation.php
Created April 19, 2012 11:04
Changing the collation of all tables in a mysql database.
<?php
// Stolen from: http://www.holisticsystems.co.uk/blog/?p=931
$server = 'localhost';
$username = 'user';
$password = 'password';
$database = 'database';
$new_charset = 'utf8';
$new_collation = 'utf8_general_ci';
@tskrynnyk
tskrynnyk / pdf2book
Last active October 3, 2015 08:27
Converting PDF file into booklet.
#!/bin/bash
# pdf2book: Converting PDF file into booklet
ERR=0
for i in pdftops psbook psnup; do
if [ ! "$(which $i)" ]; then
echo Error: $i not found
ERR=1
fi
directory "tmp"
file "tmp/hello.tmp" => "tmp" do
sh "echo 'Hello' > 'tmp/hello.tmp'"
end
task :default => 'morning:turn_off_alarm'
namespace :morning do
desc "Turn off alarm."
#!/usr/bin/env clisp
(setq dzien (nth 3 (multiple-value-list (get-decoded-time) )))
(setq miesiac-n (nth 4 (multiple-value-list (get-decoded-time) )))
(setq rok (nth 5 (multiple-value-list (get-decoded-time) )))
(setq miesiace `("stycznia" "lutego" "marca" "kwietnia" "maja" "czerwca" "lipca" "sierpnia" "września" "października" "listopada" "grudnia"))
(setq miesiac (nth (- miesiac-n 1) miesiace))
@tskrynnyk
tskrynnyk / plural-pl.pl
Created May 25, 2012 22:18
Plural in Polish
#! /usr/bin/perl
#
if (($#ARGV+1) == 1) {
$i = $ARGV[0];
$plural = $i == 1 ? 'znak' : $i % 10 >= 2 && $i % 10 <= 4 && ($i % 100 < 10 || $i % 100 >= 20) ? 'znaki' : 'znaków';
print "$i $plural\n";
}
@tskrynnyk
tskrynnyk / MathCaptcha.php
Last active November 9, 2017 09:16
Math Captcha class
<?php
/**
* Math Captcha class.
*
* Generates a simple, plain text math equation as an alternative to image-based CAPTCHAs.
*
* require __DIR__.'/../mathcaptcha.php';
*
* $captcha = new MathCaptcha();
*
@tskrynnyk
tskrynnyk / get-debian-iso-weekly-builds.sh
Created August 24, 2012 11:18
Debian ISO weekly builds
#! /bin/bash
# Debian ISO weekly builds
#
#set -x
DEBIAN_ISO_URL=(
http://cdimage.debian.org/cdimage/daily-builds/daily/current/i386/iso-cd/debian-testing-i386-netinst.iso
http://cdimage.debian.org/cdimage/daily-builds/daily/current/amd64/iso-cd/debian-testing-amd64-netinst.iso
http://cdimage.debian.org/cdimage/weekly-builds/amd64/iso-cd/debian-testing-amd64-CD-1.iso
http://cdimage.debian.org/cdimage/weekly-builds/i386/iso-cd/debian-testing-i386-CD-1.iso
@tskrynnyk
tskrynnyk / Email.gs
Created November 27, 2012 18:25
Gmail Notify
function EmailNotify() {
var label = GmailApp.getUserLabelByName('Notify');
var threads = label.getThreads();
for (var x in threads) {
var messages = threads[x].getMessages();
for (var i = 0; i < messages.length; i++) {
var message = messages[i];
if (message.isUnread()){
var emailAddressForNotify = '[email protected]';
//Logger.log(message.getFrom());