Skip to content

Instantly share code, notes, and snippets.

View fabriceleal's full-sized avatar
😫
meh

Fabrice Ferreira Leal fabriceleal

😫
meh
  • Leiria, Portugal
View GitHub Profile
class FormFoo : Form {
// ...
// This is an UI control event handler, so any errors
// that happen are going to be reported to the user (via the MessageBox.Show)
private void Bt1_Click(object sender, EventArgs e) {
try {
DoStuff();
DoStuff2();
}catch(Exception ex){
@fabriceleal
fabriceleal / gist:6540208
Last active December 22, 2015 22:29
Download files via ssh
scp user@host:/path/to/some/file.txt localfile.txt
# full folder
scp -r user@host:/path/to/some/folder localfolder
@fabriceleal
fabriceleal / gist:6538819
Created September 12, 2013 14:54
Wrap all lines in a file with "..."
cat some_in_file.txt | sed 's/^.*$/"&"/g' > some_out_file.txt
@fabriceleal
fabriceleal / gist:6376017
Created August 29, 2013 09:24
Purge a file from git's history
# From https://help.github.com/articles/remove-sensitive-data
# If you haven't done it yet:
git rm thefile.ext
# And to purge it from history
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch thefile.ext' --prune-empty --tag-name-filter cat -- --all
@fabriceleal
fabriceleal / gist:6173013
Created August 7, 2013 10:45
Remake /dev/null (if you, like me, are somehow able to break it)
# From http://www.linuxforums.org/forum/newbie/27030-bash-dev-null-permission-denied-why.html
# Do this as root
rm /dev/null
mknod -m 0666 /dev/null c 1 3
@fabriceleal
fabriceleal / gist:6163707
Last active August 22, 2021 17:15
Xdebug stuff (debugging) on php.ini
;; if you're using zend server, you may need to
;; 1 - remove/disable etc/conf.d/debugger.ini
;; 2 - comment zend.ini_scandir=... altogether
;;
;; I've had success with both :|
;; on zend server, install xdebug via pecl
;; or if you feel brave, checkout the source
;; and build it yourself (check the README,
;; watch out for the necessary configurations before make)
@fabriceleal
fabriceleal / gist:6130496
Created August 1, 2013 11:21
Fix for successful install of vmw tools
// From http://askubuntu.com/questions/40979/what-is-the-path-to-the-kernel-headers-so-i-can-install-vmware
cd /lib/modules/$(uname -r)/build/include/linux
sudo ln -s ../generated/utsrelease.h
sudo ln -s ../generated/autoconf.h
sudo ln -s ../generated/uapi/linux/version.h
@fabriceleal
fabriceleal / gist:5967790
Created July 10, 2013 16:26
Git push all branches to remote
# http://stackoverflow.com/questions/6865302/push-local-git-repo-to-new-remote-including-all-branches-and-tags
git push origin --all
@fabriceleal
fabriceleal / gist:5927077
Created July 4, 2013 11:56
Mount remote filesystem
# Ensure you have openssh-server on the remote host and sshfs on the client host
### On the remote
# https://help.ubuntu.com/10.04/serverguide/openssh-server.html
sudo apt-get install openssh-server
### On the client
# http://www.howtogeek.com/howto/ubuntu/how-to-mount-a-remote-folder-using-ssh-on-ubuntu/
# http://www.linuxnix.com/2011/03/mount-directory-locally-linux-sshfs.html
sudo apt-get install sshfs
@fabriceleal
fabriceleal / gist:5900143
Last active March 31, 2022 19:59
Recursively download site with wget
wget -r -k -p the-site -X exclude-dir-1,exclude-dir-2