Skip to content

Instantly share code, notes, and snippets.

View sergeycherepanov's full-sized avatar
:bowtie:
Focusing

S.Cherepanov sergeycherepanov

:bowtie:
Focusing
View GitHub Profile
@sergeycherepanov
sergeycherepanov / vagrant-kvm.md
Created September 21, 2016 15:30 — forked from yuanying/vagrant-kvm.md
How to use vagrant-kvm

Install Vagrant

sudo su
apt-get update && apt-get install -y libvirt-dev ruby-all-dev apparmor-utils
curl -O -L https://dl.bintray.com/mitchellh/vagrant/vagrant_1.6.5_x86_64.deb
dpkg -i vagrant_1.6.5_x86_64.deb 
aa-complain /usr/lib/libvirt/virt-aa-helper # workaround
exit

Install vagrant-kvm as user

<pre>
<?php
$username = 'admin';
$key = 'd525e743ee692632b52a05570444aa537e06a8cc';
$created = date('c');
$nonce = substr(md5(time()), 0, 16);
$sha1 = sha1($nonce . $created . $key, true);
$digest = base64_encode($sha1);
echo "user: {$username}" . PHP_EOL;
@sergeycherepanov
sergeycherepanov / dev-tld.md
Created March 4, 2016 00:39 — forked from marek-saji/dev-tld.md
Configure local DNS server to serve #dev #TLD #ubuntu #linux

Configure local wildcard DNS server

  1. Install Dnsmasq: sudo apt-get install dnsmasq
  2. Since Ubuntu's NetworkManager uses dnsmasq, and since that messes things up a little for us, open up /etc/NetworkManager/NetworkManager.conf and comment out (#) the line that reads dns=dnsmasq. Restart NetworkManager afterwards: sudo restart network-manager.
  3. Make sure Dnsmasq listens to local DNS queries by editing /etc/dnsmasq.conf, and adding the line listen-address=127.0.0.1.
  4. Create a new file in /etc/dnsmasq.d (eg. /etc/dnsmasq.d/dev), and add the line address=/dev/127.0.0.1 to have dnsmasq resolve requests for *.dev domains. Restart Dnsmasq: sudo /etc/init.d/dnsmasq restart.

source: http://brunodbo.be/blog/2013/04/setting-up-wildcard-apache-virtual-host-wildcard-dns

@sergeycherepanov
sergeycherepanov / fingerprint.php
Created February 3, 2016 20:22 — forked from xeoncross/fingerprint.php
Generate a fingerprint from and RSA SSH public key
<?php
print "\n";
$rsa = file_get_contents('rsa.pub');
$ssh = file_get_contents('ssh.pub');
// For reference
print $rsa . "\n\n";
print $ssh . "\n\n";
brew install dnsmasq
cd $(brew --prefix)
mkdir etc
echo 'address=/.dev/127.0.0.1' >> etc/dnsmasq.conf
echo 'address=/.loc/127.0.0.1' >> etc/dnsmasq.conf
sudo chown root $(brew --prefix dnsmasq)/homebrew.mxcl.dnsmasq.plist
sudo ln -s $(brew --prefix dnsmasq)/homebrew.mxcl.dnsmasq.plist /Library/LaunchDaemons/
sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
sudo mkdir /etc/resolver
sudo bash -c 'echo "nameserver 127.0.0.1" > /etc/resolver/dev'
http://brew.sh - The missing package manager for OS X
https://www.iterm2.com - iTerm2 is a replacement for Terminal
https://tunnelblick.net - free software for OpenVPN on OS X
https://github.com/jimbojsb/launchrocket - A Mac PreferencePane for managing services with launchd
http://www.sequelpro.com/ - MySQL Database Management for Mac OS X
https://itunes.apple.com/us/app/copyclip-clipboard-history/id595191960?mt=12 - Clipboard History Manager
https://monosnap.com - Free Screenshot snd Screencast Tool
http://www.kekaosx.com - Archive tool
http://bindfs.org/ - bind local folder
mysqldump --no-create-info --single-transaction --skip-triggers -uroot -p pradam $(mysql -uroot -proot pradam -e "show tables" | grep ^sales | tr '\n' ' ') > sales_tables.sql
mysql -uroot -proot pradam_new -e "show tables" | grep ^customer_ | awk '{print "delete from "$0";"}' | mysql -uroot -proot pradam_new
MYENVVAR="world" salt-call state.template test.sls
For Debian, sysbench is hard to beat. It's a simple 1-2-3:
Install
sudo apt-get install sysbench
Prepare
sysbench --test=oltp --oltp-table-size=1000000 --mysql-db=test --mysql-user=root --mysql-password=yourrootsqlpassword prepare