Skip to content

Instantly share code, notes, and snippets.

View gaintsev's full-sized avatar
🎯
Focusing

gaintsev gaintsev

🎯
Focusing
View GitHub Profile
@gaintsev
gaintsev / readme.md
Created August 28, 2018 15:50
Multiple sites on Vagrant virtual machine
  1. On the guest machine add all sites to /etc/apache2/sites-available/000-default.conf. Example:
<VirtualHost *:80>

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/foo

        ErrorLog ${APACHE_LOG_DIR}/error.log
 CustomLog ${APACHE_LOG_DIR}/access.log combined
@gaintsev
gaintsev / _.sql
Created August 6, 2018 11:45
Wordpress change admin E-Mail from database
/* Options table: */
UPDATE wp_options SET option_value = '[email protected]' WHERE option_name = 'admin_email';
/* Users table: */
UPDATE wp_users SET user_email = '[email protected]' WHERE user_login = 'admin';
@gaintsev
gaintsev / handler.php
Last active February 2, 2018 15:57
Cockpit Next - Create and Save Form from PHP
<?php
// Include Cockpit
require_once('admin/bootstrap.php');
// Set name for new form
$new_form = 'foo';
// Set data
$data = array(
@gaintsev
gaintsev / gist:df9f6c9266aab653f17ab332f574db0a
Created October 18, 2017 01:07
Gulp Error: watch ENOSPC on Ubuntu
echo fs.inotify.max_user_watches=500000 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
@gaintsev
gaintsev / install.sh
Created October 15, 2017 10:37 — forked from wdullaer/install.sh
Install Latest Docker and Docker-compose on Ubuntu
# Ask for the user password
# Script only works if sudo caches the password for a few minutes
sudo true
# Install kernel extra's to enable docker aufs support
# sudo apt-get -y install linux-image-extra-$(uname -r)
# Add Docker PPA and install latest version
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
# sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
@gaintsev
gaintsev / vdi-file-compacting.md
Created September 4, 2017 17:07
How to compact VirtualBox's VDI file size?

Source: StackOverflow

1. Run defrag in the guest (Windows only)

2. Nullify free space:

With a Linux Guest run this:

sudo dd if=/dev/zero | pv | sudo dd of=/bigemptyfile bs=4096k
sudo rm -rf /bigemptyfile
@gaintsev
gaintsev / cdn.html
Created August 23, 2017 22:55 — forked from frasurebuilds/cdn.html
Material Design Icons CDN
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<img
src="https://i.vimeocdn.com/video/{{ video_id }}.jpg"
>
find src/dir/ -name '*.txt' -exec mv {} target/dir/ \;
{% if share_url is not defined %}
{% set share_url = project.url %}
{% endif %}
{% set share_url = share_url|url_encode %}
{% if share_title is not defined %}
{% set share_title = project.readable_name %}
{% endif %}
{% set share_title = share_title|url_encode %}