Skip to content

Instantly share code, notes, and snippets.

View MekDrop's full-sized avatar

Raimondas Rimkevičius MekDrop

View GitHub Profile
@MekDrop
MekDrop / migrate.sh
Last active August 29, 2015 14:25
Script to migrate from Assembla SVN one repo to multiple GitHub repos
#!/bin/bash
# ----------------------------------------
# If You want migrate one repo from Assembla SVN to multiple GitHub repos
# (different repo - different svn folder) this script can help You :)
#
# What You need to make this script workable:
# * Change variables below
# * Install svn2git from https://github.com/nirvdrum/svn2git
# * Make sure your git works with ssh keys
@MekDrop
MekDrop / Generator From LibreOffice Calc Sheet.bas
Created January 6, 2016 22:10
This script can be used to generate HTML content from Sheet. All structure of the result is defined as template.
REM ***** BASIC *****
Function ReplaceString(SearchWhat As String, ReplaceWith AS String, Content as string) as string
len1 = LEN(SearchWhat)
len2 = LEN(Content)
pos = InStr(Content, SearchWhat)
ret = Content
if pos <> 0 then
pos = pos -1
<?php
function xlog() {
$args = func_get_args();
$line = $args[0];
unset($args[0]);
$args = array_values($args);
if (empty($args)) {
echo $line;
} else {
@MekDrop
MekDrop / Make LAMP in Ubuntu 16 (Xenial) for Vagrant ready.sh
Last active July 4, 2016 05:58
Script for Vagrant boxes to create basic LAMP
#!/bin/bash
chown -R www-data:www-data /vagrant/www
if grep -Fxq "~/.composer/vendor/bin" /etc/environment
then
echo ';)'
else
sed -i '/^PATH=/d' /etc/environment
PATH="$PATH:~/.composer/vendor/bin"
@MekDrop
MekDrop / .gitlab-ci.yml
Created December 5, 2016 16:12
GitLab CI: deploy PHP website with git-ftp over sftp
# This script should work however sftp is not supported in compiled curl so not everything fine here
#
# $_CI* vars should be defined in project variables
image: mwienk/docker-git-ftp
before_script:
- eval `ssh-agent -s`
- cat > deploy.key <(echo "$CI_SERVER_KEY")
- chmod 0600 deploy.key
@MekDrop
MekDrop / generate_sql_to_move_all_tables_from_one_database_to_other.sql
Last active February 22, 2017 10:04
This generates one SQL to be used to move one database tables to other database
# Change these variables values
set @old_db='a';
set @new_db='b';
SET SESSION group_concat_max_len = 1000000;
# Don't change anything below
SELECT CONCAT('RENAME TABLE ' , GROUP_CONCAT(cmd SEPARATOR ', ')) 'sql'
FROM (
SELECT CONCAT('`',@old_db,'`.`', TABLE_NAME, '` TO `',@new_db,'`.`', TABLE_NAME, '`') cmd
FROM information_schema.tables
@MekDrop
MekDrop / html_video_convert.bat
Last active November 13, 2017 16:02
Make from one video multiple sources HTML tag
@echo off
########################################################################################
# This script will create multiple versions files from video for your video tag
# and also generates this tag.
#
# FFMPEG is needed. Most simple way to install it: choco install ffmpeg && refreshenv
#
# This small script uses public domain license so you can do whatever you want.
########################################################################################
@MekDrop
MekDrop / win98_with_vagrant_for_games.bat
Created November 19, 2017 01:41
Windows 98 in Vagrant for games
@echo off
REM You need to install wget for windows first!
REM This command will download box (maybe there are also other win98 premade boxes for Vagrant?
REM This box doesn't work good with DirectX 3D and no SSH support (that's why vagrant displayes errors on lauch but works)
wget https://www.dropbox.com/s/btyp146041rravr/win98.box?dl=1 -O windows98.box
REM You need before vagrant with VirtualBox installed on you system
REM Adding box to vagrant
vagrant box add win98 windows98.box
@MekDrop
MekDrop / composer-from-php-code-example.php
Last active October 1, 2018 11:34
Run composer from PHP code example
<?php
/**
* This is simple PHP script that shows how to use composer directly from your PHP code
*
* First thing what you need is to include composer/composer in your composer.json
* and than you can use such code.
*/
use Composer\Console\Application;
@MekDrop
MekDrop / Vagrantfile
Last active October 1, 2018 11:21
Ask interactively values in Vagrant
# This is sample script that let user input some values interactively
# also it caches theses values in .vagrant/app_data.json so after restart
# user will not need to enter again same values
#
# To use this class you need to use DataLoader.instance.ask everywhere where you needed to have dynamic data.
#
# Syntax: DataLoader.instance.ask(VARIABLE_NAME_TO_SAVE, PROMPT_MESSAGE, DATA_TYPE)
# VARIABLE_NAME_TO_SAVE - dictionary key name where to save value
# PROMPT_MESSAGE - prompt message that will be displayed before input
# DATA_TYPE - :password or :text