Skip to content

Instantly share code, notes, and snippets.

View tot-ra's full-sized avatar
๐Ÿ

Artjom Kurapov tot-ra

๐Ÿ
View GitHub Profile
@tot-ra
tot-ra / gist:7675047
Created November 27, 2013 12:43
bash script to download file(s) over ftp to local dir
#!/bin/bash
lftp -u login,pass ftp://login@example.com <<EOF
mget -d -O /local/path/to/save/to /remote/path/to/dir/*.BIN
EOF
@tot-ra
tot-ra / gist:8f92208162310d643305
Created May 27, 2014 10:04
angularjs sprintf filter
app.filter['sprintf'] = function () {
return function (str, number) {
function parse(str) {
var args = [].slice.call(arguments, 1),
i = 0;
str = str.replace(/{(\d+)}/g, function (a, number) {
return typeof args[number] != 'undefined'
? args[number]
@tot-ra
tot-ra / mass_db_insert
Created December 15, 2015 11:29
table_load_test.sql
/* repeat X times to get (table cardinality)^X number of rows in it */
INSERT IGNORE INTO table_to_flood (a,b) SELECT FLOOR(RAND()*100000), UUID() FROM table_to_flood;
@tot-ra
tot-ra / autoloader.php
Created November 23, 2019 12:37
Autoloader pseudocode
final class Loader{
// spl_autoload_register([$this, 'loadClass'], true, $prepend);
public function findFile($class){
//...
/* autoload core without namespace classes */
if (is_file($location = ROOTPATH . 'application/core/' . $class . EXT)) {
return $location;
}
/* autoload library classes */
if (is_file($location = ROOTPATH . 'application/libraries/' . $class . EXT)) {
# Gratheon Individual Contributor License Agreement
Thank you for your interest in contributing to Gratheon ("We" or "Us").
This Contributor License Agreement ("Agreement") documents the rights granted
by contributors to Us. To make this document effective, please sign it and
send it to Us by email at contributors@gratheon.com, or submit it through our
CLA Assistant bot on GitHub.
This is a legally binding document, so please read it carefully before agreeing
@tot-ra
tot-ra / gist:78e9dcaf7061bd121ded40418400b55f
Created December 28, 2025 15:34
Why is docker taking so much space?
# List all images sorted by size (largest first)
docker images --format "table {{.Repository}}\t{{.Tag}}\t{{.Size}}" | sort -k3 -hr
# Get total disk usage breakdown
docker system df -v
# Container disk usage
docker ps --size