Skip to content

Instantly share code, notes, and snippets.

View tot-ra's full-sized avatar
🐝
Processing video with AI

Artjom Kurapov tot-ra

🐝
Processing video with AI
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://[email protected] <<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)) {