Skip to content

Instantly share code, notes, and snippets.

#define _GNU_SOURCE
#include <dirent.h> /* Defines DT_* constants */
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/syscall.h>
# 320ms user time, 30ms system time, 29.00M rss, 2.36G vsz
# Current date: Thu Sep 15 16:07:08 2016
# Hostname: Administrators-MacBook-Pro.local
# Files: /usr/local/var/mysql/Administrators-MacBook-Pro-slow.log
# Overall: 428 total, 37 unique, 0 QPS, 0x concurrency ___________________
# Attribute total min max avg 95% stddev median
# ============ ======= ======= ======= ======= ======= ======= =======
# Exec time 185ms 8us 6ms 432us 972us 418us 316us
# Lock time 43ms 0 807us 100us 194us 63us 84us
{
"id": "0fbde858-01cd-441f-bba8-15fdb92fdc65",
"version": 5,
"is_last": 1,
"type": 1,
"user_declarant_id": 422,
"created_date": "2016-09-04T16:42:35.943256",
"lastmodified_date": "2016-09-04T16:42:35.943256",
"data_step_0": {
"data": {
Serial Status Invalidity Date Comment
0x425D4BC6E44FFB10040000000100000021190000 revoked Aug 20 07:11:02 2016 GMT CN=test, O=test
0x425D4BC6E44FFB10040000000100000020190000 revoked Aug 20 07:10:44 2016 GMT CN=test, O=test
0x425D4BC6E44FFB1004000000E30E00002B190000 unknown Aug 20 07:01:03 2016 GMT ???
0x425D4BC6E44FFB1004000000E30E00002A190000 unknown Aug 20 07:00:53 2016 GMT ???
0x425D4BC6E44FFB1004000000E20E000027190000 unknown Aug 20 07:00:16 2016 GMT CN = Рябошапка Р.Г. from Aug 18 21:00:00 2016 GMT
0x425D4BC6E44FFB1004000000E20E000026190000 unknown Aug 20 07:00:09 2016 GMT CN = Рябошапка Р.Г., from Aug 18 21:00:00 2016 GMT
@samm-git
samm-git / redistest.php
Last active May 12, 2016 21:09
redis health replication role check for the ELB
<?php
// redis test
$r = new Redis();
$r->connect('127.0.0.1', 6379, 2.5); // connect to redis with 2.5 sec timeout
if(!$r) {
header('HTTP/1.1 500 Internal Server Error');
echo "Error: connection failed\n";
exit(0);
}
@samm-git
samm-git / checkmujkaktus.pl
Created March 15, 2016 13:40
Check balance on CZ kaktus prepaid GSM card
#!/usr/bin/perl
use strict;
require LWP::UserAgent;
# username/password
my $username = '[email protected]';
my $password = 'example';
binmode STDOUT, ":utf8"; # suppress UTF-8 warnings
<?php
for(;;){
usleep(20000); // 20 ms
$db = new PDO('mysql:host=slave;dbname=Magento;charset=utf8', 'dev_user1', 'XXXXXX', array(PDO::ATTR_EMULATE_PREPARES => false,
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
try {
//connect as appropriate as above
$db->query('SET NAMES utf8');
} catch(PDOException $ex) {
$uri = $this->uriFactory->create();
$socketAdapter = $this->socketAdapterFactory->create();
$servers = $this->deploymentConfig->get(ConfigOptionsListConstants::CONFIG_PATH_CACHE_HOSTS)
?: [['host' => $this->request->getHttpHost()]];
$headers = ['X-Magento-Tags-Pattern' => $tagsPattern];
$socketAdapter->setOptions(['timeout' => 10]);
foreach ($servers as $server) {
$port = isset($server['port']) ? $server['port'] : self::DEFAULT_PORT;
$uri->setScheme('http')
->setHost($server['host'])
[21-Oct-2015 20:02:06] [pool www] pid 30909
script_filename = /var/www/html/m2/pub/index.php
[0x00007ffe12ea7cb0] hGet() unknown:0
[0x00007fd804d20688] call_user_func_array() /var/www/html/m2/lib/internal/Credis/Client.php:901
[0x00007ffe12ea8060] __call() unknown:0
[0x00007fd804d204e0] hGet() /var/www/html/m2/lib/internal/Cm/Cache/Backend/Redis.php:211
[0x00007fd804d203a0] load() /var/www/html/m2/vendor/magento/zendframework1/library/Zend/Cache/Core.php:306
[0x00007fd804d20278] load() /var/www/html/m2/vendor/magento/framework/Cache/Frontend/Adapter/Zend.php:39
[0x00007fd804d20190] load() /var/www/html/m2/vendor/magento/framework/Cache/Frontend/Decorator/Bare.php:65
[0x00007fd804d200a8] load() /var/www/html/m2/vendor/magento/framework/Cache/Frontend/Decorator/Bare.php:65
{
USB_IF_PROTOCOL_VOID = 0x00,
USB_IF_PROTOCOL_3G_MODEM = 0x01,
USB_IF_PROTOCOL_3G_PCUI = 0x02,
USB_IF_PROTOCOL_3G_DIAG = 0x03,
USB_IF_PROTOCOL_PCSC = 0x04,
USB_IF_PROTOCOL_3G_GPS = 0x05,
USB_IF_PROTOCOL_CTRL = 0x06,
USB_IF_PROTOCOL_3G_NDIS = 0x07,
USB_IF_PROTOCOL_NDISDATA = 0x08,