Skip to content

Instantly share code, notes, and snippets.

View shov's full-sized avatar
🐊
^^

Alexander Shevchenko shov

🐊
^^
View GitHub Profile
@shov
shov / linked_list
Last active January 30, 2017 13:00
linked list part
class LinkedList {
constructor() {
this.headNode = null;
this.currNode = null;
}
append(data) // метод добавления элемента
{
var newNode = new Node(); // создаём новый элемент
@shov
shov / vkcom_audio_download.py
Created February 2, 2017 09:25 — forked from st4lk/vkcom_audio_download.py
Python: vkontakte.ru (vk.com) audio music downloader
# -*- coding: utf-8 -*-
"""
Скрипт для скачивания музыки с сайта vkontakte.ru (vk.com)
Запуск:
python vkcom_audio_download.py
Принцип работы:
Скрипт проверяет сохраненный access_token. Если его нет или срок истек,
то открывается страница в браузере с запросом на доступ к аккаунту.
<?php
class DB
{
public function burn(string $data)
{
if(empty($data)) throw new \Exception(sprintf("Wrong data, %s given" . PHP_EOL, $data));
echo $data . PHP_EOL;
}
}
@shov
shov / mysqldump_fordate.sh
Last active March 21, 2017 07:35
mysqldump for date
DATE=`date +%Y-%m-%d` && mysqldump -u user_name -p"" db_name > "./db_name-dump-${DATE}.sql"
@shov
shov / linkedInInviter.js
Last active April 13, 2017 13:51
Inviter script for linkedin.com
(function () {
function FriendInviteBot() {
const netUrl = "https://www.linkedin.com/mynetwork/";
var silent = false;
var buttonsList;
var alreadyCollectedUsers = [];
function timeOutDecorator(method, intervalSrc) {
return function () {
@shov
shov / event-controller-1.0.js
Last active April 17, 2017 15:41
Event Controller
(function(global){
function EventController(){
var oEvents = {};
this.doEvent = function(eventname, args) {
if(typeof(eventname) !== 'string') {
return false;
}
if(typeof(oEvents[eventname]) === 'object' && Array.isArray(oEvents[eventname])) {
@shov
shov / array-to-texttable.php
Created April 26, 2017 12:49 — forked from tony-landis/array-to-texttable.php
PHP: Array to Text Table Generation Class
<?php
/**
* Array to Text Table Generation Class
*
* @author Tony Landis <tony@tonylandis.com>
* @link http://www.tonylandis.com/
* @copyright Copyright (C) 2006-2009 Tony Landis
* @license http://www.opensource.org/licenses/bsd-license.php
*/
class ArrayToTextTable
@shov
shov / removeCR.sh
Last active May 18, 2017 09:28
Remove \r in all .sh in the current directory used tr
#!/bin/bash
function movement() {
local bname=$(basename "$1")
local fbname=${bname%.*}
mv "$1" "${fbname}"
}
find . -name '*.sh' -exec sh -c 'tr -d "\r" < "$0" > "$0.tmp"' '{}' \;
find . -name "*.sh.tmp" | while read file; do movement "$file"; done
@shov
shov / biggest10DirFile.sh
Created June 5, 2017 08:29
Looking for 10 biggest dir and file
#!/bin/bash
echo "Dirs"
du -hsx * | sort -rh | head -10
echo "Files"
find . -type f -printf '%s %p\n'| sort -nr | head -10
@shov
shov / Decorator.php
Last active December 7, 2017 09:19
PHP Implementation of the decorator as the Trait
<?php
/**
* Trait Decorator
*
* Required on host
* @method getDecoratedObject()
*/
trait Decorator
{