Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
if [[ -z $1 ]]
then
echo "Usage: $0 <env>"
echo ""
echo "Allowed env values: p1, d1, sl-loki, sl-cdfw"
echo ""
elif [[ "$1" = "p1" ]]
then
sl aws session generate --profile p1 --role-name engineer --account-id 067346688434 --region eu-west-2
import csv
import MySQLdb
from pprint import pprint
mydb = MySQLdb.connect(host='127.0.0.1',
user='root',
passwd='pa55word',
db='metro')
from flask import Blueprint, session, url_for, jsonify, request, g
from app import app
from app import oauth, oauth_client
from app.database import connection
from app.blueprints.auth import require_login
sprava = Blueprint('sprava', __name__)
sprava_app = oauth_client.remote_app(
'sprava',
lists:foldl(fun(El, Acc) ->
case El of
"10001" -> Acc + 1;
_ -> Acc
end,
0, List);
%%
%% Convert seconds, minutes etc. to milliseconds.
%%
-spec seconds(Seconds) -> MilliSeconds when
Seconds :: non_neg_integer(),
MilliSeconds :: non_neg_integer().
seconds(Seconds) ->
1000*Seconds.
-spec minutes(Minutes) -> MilliSeconds when
Minutes :: non_neg_integer(),
@sinkovsky
sinkovsky / publicsuffix.erl
Last active December 19, 2015 15:38
Draft perl script to generate public suffix parsing part of domain name
#!perl
use strict;
use warnings;
open my $fh, "<", "publicsuffix.dat";
my $tree = {};
while (<$fh>) {
!perl
use strict;
use warnings;
my $ptr = 0;
my @tape = (0) x 5000;
my $op_idx = 0;
my @cmds;
{
"keys": [
"perl_to_php_testkey",
"php_to_perl_testkey",
"php_to_perl_compressed_testkey"
],
"values": [
"this is a foo bar string", // string - just random string
42, // integer - answer to a question about universe
5.6, // float - nice apperture value :)
@sinkovsky
sinkovsky / test.pl
Created February 28, 2012 14:53 — forked from anonymous/test.pl
package Father;
$VERSION = "0.01";
sub new {
my $self = {};
bless $self;
return $self;
};
package Foo;
## моя статистика
our $stats = {};
sub new {
return bless {}, shift;
}
$SIG{INT} = sub {