Skip to content

Instantly share code, notes, and snippets.

function UUID()
{
$randomString = openssl_random_pseudo_bytes(16);
$time_low = bin2hex(substr($randomString, 0, 4));
$time_mid = bin2hex(substr($randomString, 4, 2));
$time_hi_and_version = bin2hex(substr($randomString, 6, 2));
$clock_seq_hi_and_reserved = bin2hex(substr($randomString, 8, 2));
$node = bin2hex(substr($randomString, 10, 6));
/**
@tskrynnyk
tskrynnyk / vim-tips.md
Created January 29, 2015 18:51
ViM Tips
cat ~/.ssh/id_rsa.pub | ssh remotehost 'mkdir .ssh ; cat >> .ssh/authorized_keys'
function pwp() {
HOST2PING=${1:-212.77.100.101}
SLEEP_TIME=5s
LAST_ERR=127
clear
echo HOST: $HOST2PING
while true; do
ping -c1 -W5 $HOST2PING >/dev/null
ERR=$?
if [ "$LAST_ERR" -ne "$ERR" ]; then
@tskrynnyk
tskrynnyk / pl.intl.kbd
Created January 12, 2015 21:39
Polish terminal keymap like "pl(intl)" in X
# keymaps/pl.intl.kbd
#
# Polish keymap by Krzysztof Mlynarski (17:46 27-04-1996 MET DST)
# ([email protected])
# 2015-01-12 Tomasz Skrynnyk <dev%skrynnyk.pl>
# * changes based on the Polish keymap pl(intl): "Polish
# (international with dead keys)" in 'xkb/symbols/pl' file.
# * turn off Caps Lock key.
# alt
# scan cntrl alt alt cntrl lock
@tskrynnyk
tskrynnyk / login.conf.patch
Created January 12, 2015 02:07
UTF-8 on FreeBSD
--- /etc/login.conf 2015-01-01 01:00:00.000000000 +0100
+++ login.conf_new 2015-01-01 03:10:00.000000000 +0100
@@ -26,7 +26,7 @@
:passwd_format=sha512:\
:copyright=/etc/COPYRIGHT:\
:welcome=/etc/motd:\
- :setenv=MAIL=/var/mail/$,BLOCKSIZE=K:\
+ :setenv=MAIL=/var/mail/$,BLOCKSIZE=K,LC_COLLATE=C:\
:path=/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin ~/bin:\
:nologin=/var/run/nologin:\
@tskrynnyk
tskrynnyk / login_conf.patch
Created January 12, 2015 02:01
UTF-8 for user on FreeBSD
--- .login_conf 2015-01-01 01:00:00.000000000 +0100
+++ .login_conf_new 2015-01-01 02:50:50.000000000 +0100
@@ -5,3 +5,7 @@
#me:\
# :charset=iso-8859-1:\
# :lang=de_DE.ISO8859-1:
+me:\
+ :charset=UTF-8:\
+ :lang=pl_PL.UTF-8:\
+ :setenv=LC_COLLATE=C:
#! /bin/bash
#
LC_ALL=C
#DIR_SRC=/var/www/squid-reports
DIR_SRC=/mnt/arch/squid-reports
DIR_DSC=/mnt/arch/squid-reports
# ------------------------------------------------------------------------------
# Daily
<?php
class Logger {
private static $file = '../log/app.log';
private static function log($level, $msg) {
$keys = array(
'HTTP_HOST',
'REDIRECT_STATUS',
'REQUEST_METHOD',
'REMOTE_ADDR',
# .tmux.conf
#
#setenv -g lightcolor "white"
#setenv -g darkcolor "blue"
set-option -g default-terminal "screen-256color"
set-option -g base-index 1