Tips Random

Python

import sys
for i in range(0,16):
    for j in range(0,16):
        code = str(i*16+j)
        sys.stdout.write(u"\u001b[38;5;" + code + "m " + code.ljust(4))
    print u"\u001b[0m"
import sys
for i in range(0,16):
    for j in range(0,16):
        code = str(i*16+j)
        sys.stdout.write(u"\u001b[48;5;" + code + "m " + code.ljust(4))
    print u"\u001b[0m"
import time
def loading():
    print "loading..."
    for i in range(0, 100):
        time.sleep(0.03)
        sys.stdout.write(u"\u001b[1000D" + str(i+1) + "%")
        sys.stdout.flush()
    print

loading()
import time, sys
def loading():
    print "loading..."
    for i in range(0, 100):
        time.sleep(0.03)
        width = (i+1)/4
        bar = "[" + "#" * width + " " * (25 - width) + "]"
        sys.stdout.write(u"\u001b[1000D" + bar)
        sys.stdout.flush()
    print

loading()

terminal kayak parrot :

nano ~/.bashrc

edit PS1 :

PS1="\[\033[0;31m\]\342\224\214\342\224\200\$([[ \$? != 0 ]] && echo \"[\[\033[0;31m\]\342\234\227\[\033[0;37m\]]\342\224\200\")[$(if [[ ${EUID} == 0 ]]; then echo '\[\033[01;31m\]root\[\033[01;33m\]@\[\033[01;96m\]\h'; else echo '\[\033[0;39m\]\u\[\033[01;33m\]@\[\033[01;96m\]\h'; fi)\[\033[0;31m\]]\342\224\200[\[\033[0;32m\]\w\[\033[0;31m\]]\n\[\033[0;31m\]\342\224\224\342\224\200\342\224\200\342\225\274 \[\033[0m\]\[\e[01;33m\]\\$\[\e[0m\]"

edit PS1 di root :

sudo su
nano /root/.bashrc

edit PS1 :

PS1="\[\033[0;31m\]\342\224\214\342\224\200\$([[ \$? != 0 ]] && echo \"[\[\033[0;31m\]\342\234\227\[\033[0;37m\]]\342\224\200\")[$(if [[ ${EUID} == 0 ]]; then echo '\[\033[01;31m\]root\[\033[01;33m\]@\[\033[01;96m\]\h'; else echo '\[\033[0;39m\]\u\[\033[01;33m\]@\[\033[01;96m\]\h'; fi)\[\033[0;31m\]]\342\224\200[\[\033[0;32m\]\w\[\033[0;31m\]]\n\[\033[0;31m\]\342\224\224\342\224\200\342\224\200\342\225\274 \[\033[0m\]\[\e[01;33m\]\\$\[\e[0m\]"

Setting mendadak rusak saat hapus

sudo apt-get remove unity-control-center
sudo apt-get install unity-control-center

jika ada lagi yg rusak, maka : (jika benar-benar urgent)

sudo apt-get install ubuntu-desktop

git graph

git log --all --decorate --oneline --graph

atau buat command graph

alias graph="git log --all --decorate --oneline --graph"