Skip to content

Instantly share code, notes, and snippets.

@dayfuaim
dayfuaim / DenisYurashkuFindIndex.pm
Last active Nov 1, 2015
Поиск в массиве индекса элемента, ближайшего к заданному. OOPed. :)
View DenisYurashkuFindIndex.pm
package DenisYurashkuFindIndex;
use strict;
use utf8;
sub new {
my $invocant = shift;
my $class = ref($invocant) || $invocant;
my $self = {};
bless($self, $class);
$self->{STEPS} = 0;
View tst_ae.pl
#!/usr/bin/perl -w
#
use strict;
use feature ':5.10';
use utf8;
use open qw(:std :utf8);
use DDP;
use Term::ANSIColor qw(:constants);
$Term::ANSIColor::AUTORESET = 1;
@dayfuaim
dayfuaim / closure_table.md
Created Jun 8, 2016
Persistent tree structure using closure table in MySQL
View closure_table.md

Using closure tables to manage hierarchical relations in MySQL

Create DB tables

Create a table to represent tree nodes.

CREATE TABLE `tree_node` (
    `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `data_body` text,

node_deleted datetime DEFAULT NULL,

@dayfuaim
dayfuaim / git_files
Last active Feb 15, 2017
Get all files created/changed in the BRANCH
View git_files
#!/bin/bash
#
# Usage: git_files <BRANCH>
#
# Get all files created/changed in the BRANCH
#
git diff --stat `git merge-base master $1`..$1
View optimize.sh
#!/bin/bash
PROGNAME=${0##*/}
INPUT=''
QUIET='0'
NOSTATS='0'
max_input_size=0
max_output_size=0
usage()
@dayfuaim
dayfuaim / gist:0001d084157b562c89224b678ff98c3b
Created Dec 26, 2018 — forked from davidnunez/gist:1404789
list all installed packages in android adb shell
@dayfuaim
dayfuaim / mojo-vue.pl
Created Apr 29, 2019 — forked from Tekki/mojo-vue.pl
Mojolicious - Vue.js Example
View mojo-vue.pl
#!/usr/bin/env perl
use Mojolicious::Lite -signatures;
get '/' => sub ($c) {
$c->render(template => 'index');
};
get '/api/:region' => sub ($c) {
my %regions = (
@dayfuaim
dayfuaim / AlbumsOrder.scpt
Last active Mar 7, 2020 — forked from jkbockstael/AlbumsOrder.scpt
AppleScript to get iTunes to sort albums by release date
View AlbumsOrder.scpt
-- Fix albums display order
-- Changes the "sort album" field, to ensure that albums get displayed in chronological order on iPods.
-- CC-BY-NC 2011, Jean-Karim Bockstael,
tell application "iTunes"
-- input checking
if selection is {} then
display dialog "You must select at least a track"
return
else
set selected_tracks to selection
@dayfuaim
dayfuaim / mpv.conf
Created Jul 30, 2020 — forked from shabbir-hasan/mpv.conf
MPV Configuration (mpv.conf) on Windows 10 Pro
View mpv.conf
# vim: syntax=config
###########
# General #
###########
priority=high
input-ipc-server=/tmp/mpvsocket # listen for IPC on this socket
load-stats-overlay=yes # use local stats.lua
View gresource-extract
#!/bin/bash
##############################################################################
# Author: Peter Gordon <peter@thecodergeek.com>
# License: Public Domain
##############################################################################
# gresource-extract.sh
# Version: 1
#
# This Bash script is designed to extract all resource files in a given
# GResource file, with the given base folder. For example, if a GResource file