Skip to content

Instantly share code, notes, and snippets.

@cuchac
cuchac / memcache_dump_lru_crawler_metadump.php
Last active April 12, 2021 05:45
Dump all memcached keys using `lru_crawler metadump all`
<?php
function getAllKeys(\Memcached $mc): array
{
$allKeys = [];
foreach ($mc->getServerList() as $id => $server) {
$sock = fsockopen($server['host'], $server['port'], $errno, $errstr, 1);
@cuchac
cuchac / Dockerfile
Last active March 25, 2021 12:47 — forked from skurfuerst/build.sh
GitLab and Rancher 2 Authentication Proxy
FROM golang:1.14 AS builder
WORKDIR /go/src/app
COPY . .
RUN sh build.sh
FROM alpine:latest
RUN apk --no-cache add ca-certificates
@cuchac
cuchac / CzechBankAccountCheck.js
Created March 5, 2019 07:36
Czech bank account number validity check / Kontrola validnosti českého čísla účtu
function checkBankAccountNumber(account) {
var matches = /^(([0-9]{0,6})-)?([0-9]{1,10})\/([0-9]{1,6})$/.exec(account);
if (!matches) {
return false;
}
return checkDigit11(matches[2]) && checkDigit11(matches[3]);
}
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>
<body>
<style type="text/css" media="all">
@cuchac
cuchac / Debug smarty with firebug
Created September 2, 2014 08:10 — forked from gtraxx/Debug smarty with firebug
Shows all Smarty variables in tree-view directly in console. Always available and easy to access
{* Smarty *}
{capture name='_smarty_debug' assign=debug_output}
<script type="text/javascript">
// <![CDATA[
window.smarty ={};
{if $assigned_vars != null}
{foreach $assigned_vars as $vars}
window.smarty['{$vars@key|escape:'javascript'}'] = {$vars|@json_encode nofilter};
{/foreach}