This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dd if=/dev/zero of=1tb.img bs=1 count=0 seek=$((1<<40)) | |
ls -lh 1tb.img |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add current user to group docker | |
sudo usermod -aG docker $USER | |
# replace current subshell with a new one with updated group memberships | |
exec sudo -sEu $USER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# select target root partition | |
if [ $1 ] | |
then | |
root=$1 | |
else | |
# asuming the system is at the first ext partition | |
root=/dev/`lsblk -f | awk ' | |
$2 ~ "ext" { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# mute | |
function mute() | |
{ | |
${@:1} &> /dev/null | |
} | |
# mute completion -*- shell-script -*- | |
_mute() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# styles | |
declare -A styles=( | |
["normal"]="0" | |
["bold"]="1" | |
["dark"]="2" | |
["under"]="4" | |
["invert"]="7" | |
["background"]="8" | |
["negate"]="9" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
sudo create_ap `ifconfig -a | awk '/^w.*Ethernet/ { print $1; exit }` `ifconfig -a | awk '/^w.*Ethernet/ { print $1; exit }` $* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
function net-interfaces(){ | |
echo `ip -c=never addr | gawk 'match($0, /[[:digit:]]+: ([[:alnum:]]+):/, m) { print m[1] }'` | |
} | |
function wireless() { | |
echo `ip -c=never addr | gawk 'match($0, /[[:digit:]]+: (w[[:alnum:]]+):/, m) { print m[1] }'` | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
function bak() { | |
name=${1%/} | |
prefix=${name%.bak} | |
if [[ $prefix == $name ]]; then | |
backup $name | |
else | |
unbackup $name | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
info=`acpi` | |
level=`echo $info | grep -Eo '[0-9]{,3}%' | tr -d '%'` | |
msg=`echo $info | sed 's/.*: //g'` | |
if [ $# = 0 ] | |
then columns=$((`tput cols` - 2)) | |
else columns=$(( $1 - 2 )) | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import argparse, os, sys | |
( | |
NO_ERR, | |
READ_ERR, | |
WRITE_ERR, | |
BACKUP_ERR, | |
) = range(4) |
NewerOlder