Skip to content

Instantly share code, notes, and snippets.

View devhero's full-sized avatar
😁

Andrea Parisi devhero

😁
  • devhero
  • Milan
View GitHub Profile
@devhero
devhero / ubuntu viewports switch keys
Created June 23, 2015 09:56
switch between viewports like OSX
http://www.webupd8.org/2014/11/how-to-use-compiz-in-ubuntu-mate-1404.html
sudo apt-get install compiz compiz-plugins compizconfig-settings-manager
launch "compizconfig settings manager" => Ubuntu Unity Plugin => Switcher (allow disabling of Default Switchers):
Switcher all viewports => <Alt>Tab
Previous window Switcher all viewports => <Shift><Alt>Tab
@devhero
devhero / postgres_backup_restore
Last active April 29, 2022 10:16
postgres backup/restore
sudo su postgres
# BACKUP
vacuumdb -U postgres --full --analyze --dbname $DBNAME && pg_dump $DBNAME -Ft -v -U postgres -f /tmp/$DBNAME.tar
# RENAME TARGET DB
psql
alter database $T_DBNAME rename to NEWNAME
# OR DROP TARGET DB
@devhero
devhero / dumb file
Last active August 29, 2015 14:23
dumb file
http://www.dreamcreative.net/how-tos/guides-server-maintenance/how-to-create-a-dummy-file-in-linux/
dd if=/dev/zero of=dumb.dump bs=52428800 count=1
@devhero
devhero / ubuntu key mapper
Last active August 29, 2015 14:23
How to make ubuntu keyboard work like OSX System Wide?
http://askubuntu.com/questions/10008/how-to-make-keyboard-work-like-osx-system-wide
Install AutoKey (apt-get install autokey-gtk) and set a phrase to:
Phrase Text: <ctrl>+C (actually type out the <ctrl>+ here)
Paste Using: Keyboard
Abbreviation: None
Hotkey: <super>+v
Window Filter: None
@devhero
devhero / ubuntu_guest_additions.txt
Last active August 29, 2015 14:23
ubuntu virtual box guest additions update
http://ubuntuhandbook.org/index.php/2015/05/virtualbox-4-3-28-released-how-to-upgrade/
Install vagrant guest additions:
vagrant plugin install vagrant-vbguest
If you want to add VBox official Linux repository and receive future updates, do below steps:
1. Open terminal from the Dash or by pressing Ctrl+Alt+T. When it opens, run command to add VBox repository:
sudo sh -c 'echo "deb http://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib" >> /etc/apt/sources.list.d/virtualbox.list'
@devhero
devhero / vagrant broken networking
Last active August 29, 2015 14:23
Vagrant: Broken Networking When Packaging Ubuntu Boxes
http://able.cd/b/2012/04/09/vagrant-broken-networking-when-packaging-ubuntu-boxes/
(https://github.com/jedi4ever/veewee/issues/970)
# SSH into running VM and remove the persistant network udev rules file:
sudo rm /etc/udev/rules.d/70-persistent-net.rules
# Shutdown the VM and package it:
vagrant halt && vagrant package
@devhero
devhero / ubunu disable home encryption
Created June 26, 2015 09:15
How to stop using built-in home directory encryption?
http://askubuntu.com/questions/4950/how-to-stop-using-built-in-home-directory-encryption
1 Backup the home directory while you are logged in:
sudo cp -rp /home/user /home/user.backup
[Check that your home backup has everything!!!]
2 switch to using root (another user account with sudo privileges would work equally well).
3 Delete your home directory rm -rf /home/user
@devhero
devhero / vagrant export box image
Created June 30, 2015 07:18
vagrant export box image
vagrant package --base $vbox_machine_name --output mybox.box
@devhero
devhero / win xp virtualbox missing ethernet
Created July 1, 2015 09:05
Windows XP Guest in Virtualbox missing Ethernet adapter drivers
http://ubuntuforums.org/showthread.php?t=1106684
1.I shutdown Windows XP guest OS
2.Change Network Adpater to "Intel PRO/1000 MT Desktop"
3.Startup Windows XP Guest OS
4.Download driver from http://downloadcenter.intel.com/Detail_Desc.aspx?agr=Y&DwnldID=18717&lang=eng
5.Use "Shared Folders" on VirtualBox to share the driver to Guest OS
6.Install the driver.
@devhero
devhero / ruby threads finish together
Created July 2, 2015 08:51
Ruby wait for all threads finish
http://stackoverflow.com/questions/6241384/how-do-i-manage-ruby-threads-so-they-finish-all-their-work
require 'thread'
require 'thwait'
threads = []
threads << Thread.new { }
threads << Thread.new { }
ThreadsWait.all_waits(*threads)