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
sudo apt-get -y install git && mkdir -p ~/bin/post_install && git clone https://github.com/mamiu/ubuntu-post-install.git ~/bin/post_install && /bin/bash ~/bin/post_install/post-install.sh
#!/usr/bin/env python
import os
import time
import subprocess
time.sleep(0.1)
rows, cols = subprocess.check_output(["stty", "size"]).split()
rows = int(rows)
cols = int(cols)
@mamiu
mamiu / .promptline.fish
Last active October 29, 2015 15:44
This is a fish script for a powerline like prompt in the fish shell. To use it, just source this script with ". /path/to/.promptline.fish" (without the quotation marks) in your ~/.config/fish/config.fish! Have fun :)
# to use this script you need the latest fish version (2.1.x)
begin
########## USER CONFIG ##########
# enable or disable the different parts of promptline with yes or no
set show_only_left_prompt no
set show_hostname no
set show_virtual_env yes
set show_username yes
set show_current_working_directory yes
set show_git_branch yes
dir
├folder
│ ├code.c
│ └text.txt 
├anotherfolder
│ └subfolder
│   └document.doc
├somefile.txt

└.config.conf

@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
#!/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 / 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}')
@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 / 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 / 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");
});
}