Skip to content

Instantly share code, notes, and snippets.

@tskrynnyk
tskrynnyk / update-vpnbook-pass.py
Created September 11, 2013 01:41
Update password for vpnbook.com in NeworkManager.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, re, fileinput, glob
from BeautifulSoup import BeautifulSoup
import urllib2
page = urllib2.urlopen("http://www.vpnbook.com/")
soup = BeautifulSoup(page)
data = soup.find("li", id="openvpn")
@tskrynnyk
tskrynnyk / time.sh
Last active September 4, 2018 07:37
perl -e 'use POSIX; $|=1; while(1){ print strftime ("\r%H:%M:%S", localtime ()); select (undef, undef, undef, 0.50);}'
/**
* Using Google Apps Script to enhance my gmail filters.
*
* I constantly receive email that are important for a short period of time (When I order food online!!!!) but after
* the email is no longer relative (When I get my food!) I have no need for this email. Sadly they tend to pile up on me
* (I eat a lot).
*
* Anyways you can add this 8hrDelete.gs file to https://script.google.com and set it up on a "Time Driven" trigger at what
* ever time you'll like. I run it at midnight
*/

Create Github/Bitbucket Mirror

Create SSH key and configure

Create Key (no passphrase and name mirror the key)

ssh-keygen -t rsa -N "" -f ~/.ssh/mirror
@tskrynnyk
tskrynnyk / 10vpn-auto
Created December 6, 2012 19:19
NetworkManager dispatcher for connect to a VPN after a network-connection is established.
#! /bin/bash
IF_NAME="Ifupdown (eth0)"
VPN_NAME="My VPN" # default VPN
active_if=$(nmcli con status | grep "${IF_NAME}")
#active_vpn=$(nmcli con status | grep "${VPN_NAME}")
active_vpn=$(nmcli -t -f VPN con status | grep 'yes')
if [ "${active_if}" -a ! "${active_vpn}" ]; then
@tskrynnyk
tskrynnyk / responsive-js-ext.html
Created November 28, 2012 05:51 — forked from alexisg/responsive.html
Simple responsive design test page. More info here: http://bricss.net/post/16538278376/simple-responsive-design-test-page. Forked by alexisg to add 15 pixels of width to frame sizes (for scrollbars) and added mobile landscape/large desktop sizes. Simply a
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Responsive Design Testing</title>
<style type="text/css">
body { background: #eee; font-family: sans-serif; margin: 20px; overflow-x: scroll; }
.wrapper { width: 6000px }
.frame { float: left }
h2 { color: hsl(210,10%,7%); margin: 0 0 5px 0; text-shadow: rgba(255,255,255,.75) 0 1px 0; }
@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());
@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 / 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 / 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";
}