Skip to content

Instantly share code, notes, and snippets.

View paranoiq's full-sized avatar
🍵
418 I am a teepot

Vlasta Neubauer paranoiq

🍵
418 I am a teepot
View GitHub Profile
@paranoiq
paranoiq / key.regexp.txt
Last active March 14, 2025 17:56
public RSA key validation regexp
#ssh-rsa AAAA[0-9A-Za-z+/]+[=]{0,3} ([^@]+@[^@]+)#
// this is the most simple case. see more complete regexps in coments below
// http://generator.my-addr.com/generate_ssh_public_rsa_key-private_rsa_key-ssh_pair_online_tool.php
// https://help.ubuntu.com/community/SSH/OpenSSH/Keys
// http://www.ietf.org/rfc/rfc4716.txt
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Blikátko simulátor</title>
</head>
<body>
<style>
html, body { margin: 0; padding: 0; }
</style>
@paranoiq
paranoiq / check_foreign_keys.sql
Last active December 25, 2015 16:29
vygeneruje SQL pro kontrolu integrity celé databáze, pokud někdo vypnul cizí klíče a rozbil data
SELECT
/*fk.CONSTRAINT_SCHEMA,
fk.CONSTRAINT_NAME,
fk.TABLE_NAME,
col.COLUMN_NAME,
fk.REFERENCED_TABLE_NAME,
col.REFERENCED_COLUMN_NAME,*/
CONCAT('SELECT * FROM `', fk.TABLE_NAME, '` WHERE `', col.COLUMN_NAME, '` NOT IN (SELECT `', col.REFERENCED_COLUMN_NAME, '` FROM `', fk.REFERENCED_TABLE_NAME, '`);') AS query
FROM `REFERENTIAL_CONSTRAINTS` fk
JOIN KEY_COLUMN_USAGE col USING (CONSTRAINT_SCHEMA, CONSTRAINT_NAME)
-- kontrola uzávorkování bitových operátorů
\s[|&^]\s([a-zA-Z]+::[A-Z_]|[0-9]+)+\s(!?==+|[<>]=?|<>)\s
@paranoiq
paranoiq / sql-replacements.sql
Last active August 29, 2015 14:08
variable lengh string replacements in MySQL without PCRE UDF extension
-- variable lengh replacements without PCRE UDF extension
-- replaces only one different matched string in each pass!
-- replace string of variable length with known beginning and end
SET @start = 'xxx';
SET @finish = 'yyy';
SET @replacement = '';
UPDATE `table` SET
`text` = REPLACE(
@paranoiq
paranoiq / casting.php
Created November 2, 2014 14:16
casting in PHP
<?php
class Abc {
public $a = 1;
protected $b = 2;
private $c = 3;
}
$resource = tmpfile();
@paranoiq
paranoiq / pecl_http-stub.php
Last active August 29, 2015 14:12
Generated stub file for PHP extension `http` v2.1.4
<?php
// extension: http
// version: 2.1.4
namespace {
define('http\Client\Curl\HTTP_VERSION_1_0', 1);
define('http\Client\Curl\HTTP_VERSION_1_1', 2);
define('http\Client\Curl\HTTP_VERSION_ANY', 0);
@paranoiq
paranoiq / Assert.php
Last active August 29, 2015 14:20
Tester\Assert with fixed order of parameters
<?php
namespace Dogma\Tester;
/**
* Tester\Assert with fixed order of parameters
*/
class Assert extends \Tester\Assert
{
- rule for Rewriter extension for Chrome
- makes gist editation window on GitHub much bigger
"match": ["rows=\"17\""], "substitute": "rows=\"80\"", "url": ["https://gist.github.com"];