Skip to content

Instantly share code, notes, and snippets.

@chlp
chlp / symmetric-encode-decode.php
Created December 4, 2018 16:21
Example of usage OpenSSL symmetric encoding and decoding with AES-256-CBC on php and from command line
<?php
// ENCRYPTION
$method = 'AES-256-CBC';
$secret = 'my secret';
$key = 'test';
$hex_key = (bin2hex($key)); // example 74657374
$length = openssl_cipher_iv_length($method);
$iv = openssl_random_pseudo_bytes($length);
// $iv = hex2bin("047ed7c4aaf0069daa06b633b86aff67");
#!/bin/bash
translit() {
local NAME=${*:-$(cat)};
local TRS;
TRS=$(sed "y/абвгдезийклмнопрстуфхцы/abvgdezijklmnoprstufxcy/" <<< "$NAME")
TRS=$(sed "y/АБВГДЕЗИЙКЛМНОПРСТУФХЦЫ/ABVGDEZIJKLMNOPRSTUFXCY/" <<< "$TRS")
TRS=${TRS//ч/ch};
TRS=${TRS//Ч/CH} TRS=${TRS//ш/sh};
TRS=${TRS//Ш/SH} TRS=${TRS//ё/jo};
@chlp
chlp / bootstrap_responsive_text-align.css
Last active August 13, 2017 12:47
bootstrap responsive text-align
@media (max-width: 767px) {
.text-xs-left {
text-align: left !important;;
}
.text-xs-right {
text-align: right !important;
}
@chlp
chlp / shri.js
Last active August 29, 2015 14:24 — forked from verkholantsev/shri.js
/**
* Реализация API, не изменяйте ее
* @param {string} url
* @param {function} callback
*/
function getData(url, callback) {
var RESPONSES = {
'/countries': [
{name: 'Cameroon', continent: 'Africa'},
{name :'Fiji Islands', continent: 'Oceania'},