Skip to content

Instantly share code, notes, and snippets.

View mamiu's full-sized avatar
🏄‍♂️
Gone kitesurfing

Paul Miu mamiu

🏄‍♂️
Gone kitesurfing
  • Gold Coast, Australia
View GitHub Profile
@mamiu
mamiu / install_mosh.md
Last active November 8, 2019 18:30
Set up mosh (mobile shell) on Uberspace and Mac OS X

##Set up mosh (mobile shell) on Uberspace and Mac

First of all you have to email the Uberspace team (hallo@uberspace.de) and ask for opening an UDP port for mosh (don't forget to mention your username and uberspace server [you can get it with the command hostname]).

####On the Uberspace server:

Issue following command to execute the script from below:

curl -L http://goo.gl/PBo45c | bash
@mamiu
mamiu / install_vagrant.sh
Created March 21, 2015 18:35
install vagrant on uberspace
#!/bin/bash
mkdir ~/vagrant_tmp
cd ~/vagrant_tmp
wget https://dl.bintray.com/mitchellh/vagrant/vagrant_1.7.2_x86_64.rpm
rpm2cpio vagrant_1.7.2_x86_64.rpm | cpio -id
mv ./opt/vagrant/bin/vagrant ~/.toast/armed/bin/
mv ./opt/vagrant/embedded/ ~/.toast/armed/
cd && rm -rf ~/vagrant_tmp
@mamiu
mamiu / contacForm.js
Last active August 29, 2015 14:15
EventEmitter sample for Lornez ;)
var contactForm = function(){
EventEmitter.call(this);
var submit = function(email, name, message){
this.emit("submitContactForm", email, name, message);
}
var validateForm = function(email, name, message){
//check if all required fields are filled and the text is valid (no attacks)
this.emit("validated", email, name, message);
@mamiu
mamiu / contactForm.js
Last active August 29, 2015 14:15
callback sample for Lorenz ;)
var contactForm = function(){
var submit = function(email, name, message, callback){
validateForm(email, name, message, function(isValid){
if(isValid){
sendContent(email, name, message, function(succeeded){
if(succeeded){
showInfo(function(){
callback("Message sent successfully");
});
}
@mamiu
mamiu / projector_image_size_problem.md
Last active August 29, 2015 14:07
Changing image size of a projector (problem description)

Projector image positioning problem

This is my projector screen:

Projector Screen

And that's how the image look like:

Projector screen - current image

@mamiu
mamiu / install_fish.sh
Last active April 19, 2017 14:18
Fish shell installer for uberspace.
#!/bin/bash
std_install_dir="${HOME}/.toast/armed"
printf "The standard install directory is [${std_install_dir}].\nIf you want to change it, insert another directory: ${HOME}/"
read install_dir
if [[ "$install_dir" == "" ]]; then
install_dir="$std_install_dir"
else
@mamiu
mamiu / recursive_file_info.sh
Created September 20, 2014 11:16
The Mac version
#!/bin/bash
find . -type f -name '*' -print0 | while IFS= read -r -d '' file
do
name=$(basename "$file")
path=$(dirname "$file")
# full_path=$(readlink -f "$file") # This only works on Linux
full_path=$(echo "$PWD/${file#./}")
extension=${name##*.}
size_human_readable=$(ls -lh "$file" | awk -F' ' '{print $5}')
#!/bin/bash
find . -type f -name '*' -print0 | while IFS= read -r -d '' file
do
name=$(basename "$file")
path=$(dirname "$file")
full_path=$(readlink -f "$file")
extension=${name##*.}
size_in_bytes=$(stat -c%s "$file")
size_human_readable=$(ls -lh "$file" | awk -F' ' '{print $5}')
@mamiu
mamiu / init_install.sh
Last active August 29, 2015 14:06
This init script downloads the dotfiles and starts the install script.
sudo apt-get update && sudo apt-get -y upgrade && sudo apt-get autoremove && sudo apt-get update
sudo apt-get -y install git ruby rubygems-integration
sudo gem install homesick
homesick clone mamiu/dotfiles
bash ~/.homesick/repos/dotfiles/install.sh
dir
├folder
│ ├code.c
│ └text.txt 
├anotherfolder
│ └subfolder
│   └document.doc
├somefile.txt

└.config.conf