Skip to content

Instantly share code, notes, and snippets.

View smileart's full-sized avatar
:octocat:
Work In Progress

Serge Bedzhyk smileart

:octocat:
Work In Progress
View GitHub Profile
@smileart
smileart / db_backup.sh
Last active November 2, 2015 16:35
MySQL DB backup script
#! /usr/bin/env bash
PRESERVE_FILES_COUNT=3
ARCHIVE_EXTENSION='.sql.bz2'
if [ ! -z $1 ] && [ ! -z $2 ] && [ ! -z $3 ] && [ ! -z $4 ]; then
backup_dir=$1
db_user=$2
db_pass=$3
db_name=$4
archive_name="$(date +\%m\%d\%Y-\%H\%M\%S)_$db_name.sql.bz2"
@smileart
smileart / euruko2015.md
Last active October 20, 2023 07:20
Euruko 2015
#!/bin/bash
#
# This script will mount /Users in the boot2docker VM using NFS (instead of the
# default vboxsf). It's probably not a good idea to run it while there are
# Docker containers running in boot2docker.
#
# Usage: sudo ./boot2docker-use-nfs.sh
#
@smileart
smileart / keybase.md
Created July 9, 2015 15:27
keybase.md

Keybase proof

I hereby claim:

  • I am smileart on github.
  • I am smileart (https://keybase.io/smileart) on keybase.
  • I have a public key whose fingerprint is FD58 5BDB BCC3 16CC D35B 3D84 4BE7 D8CF D397 7061

To claim this, I am signing this object:

@smileart
smileart / apple_music.js
Created July 4, 2015 15:25
JXA script which automates playlists import to the Apple Music using iTunes
// ======= Motivation ========
// http://www.theverge.com/2015/6/30/8871591/spotify-to-apple-music-migrate
// http://i.giphy.com/1zTqgW6bS2jWU.gif
// https://goo.gl/lMTvOj
// All the delays in this script could be adapted
// for your own needs…
// Add this code to the Script Editor (OS X Only!)
// and press Run… http://i.giphy.com/QfGMSZ25v3pGU.gif
@smileart
smileart / vim.min
Last active January 16, 2017 15:08
An opinionated minimalistic vim setup for any bare or unfamiliar server
# https://github.com/rgrove/rawgit + https://github.com/rstacruz/vim-opinion +
# https://github.com/tpope/vim-sensible + https://github.com/tpope/vim-sleuth +
# https://sunaku.github.io/vim-256color-bce.html +
# http://bit.ly = vim.min
#
# © Smile @rT, 2015
VIM_MIN="/tmp/vim.min"
echo -e "se nocp\nruntime plugin/netrwPlugin.vim\nset t_ut=" > $VIM_MIN
curl -Ls -XGET https://rawgit.com/rstacruz/vim-opinion/master/plugin/opinion.vim >> $VIM_MIN
curl -Ls -XGET https://rawgit.com/tpope/vim-sensible/master/plugin/sensible.vim >> $VIM_MIN
@smileart
smileart / ini_edit
Last active January 2, 2022 14:36
A little bash functions set to work with *.ini files
#!/usr/bin/env bash
# param_1: string | param_2: file
is_option_in_file () {
if [[ ! -z "$1" && ! -z "$2" ]]; then
egrep -q "$1" "$2"
if [[ $? = '0' ]]
then
echo '1'
@smileart
smileart / last_love.rb
Created July 10, 2014 12:17
Small stupid script to sync last.fm favorites with VK audio
#!/usr/bin/env ruby
require 'lastfm'
require 'launchy'
require 'letters'
require 'faraday'
require 'json'
require 'colorize'
class LastLove
@smileart
smileart / visa.rb
Created June 16, 2014 13:14
Little script to check UK visas
#!/usr/bin/env ruby
# watch -n900 ~/visa.rb
require 'mechanize'
require 'pushover'
PUSHOVER_USER_KEY = 'c05138ffb9af54d98e8969874a611969'
PUSHOVER_APP_TOKEN = '1aec7a21cda115407a4a96d12435c28d'
VISAS_LIST_PAGE_URL = 'http://www.ge2ua.tpcontact.co.uk/tlscontact'
VISAS_LIST_PAGE_XPATH = '//*[@id="node-12"]/div[1]/div/div/div/p[1]'