This file contains hidden or 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
| Below is an example. | |
| To remove a node from backend. | |
| socat readline /var/run/haproxy.stat | |
| disable server <backend_node>/<hostname> |
This file contains hidden or 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 bash | |
| [[ "$1" == "up" ]] && amixer set Master 5%+ | |
| [[ "$1" == "down" ]] && amixer set Master 5%- | |
| [[ "$1" == "mute" ]] && amixer sset Master toggle | |
| FRONT_LEFT=$(amixer get Master | grep -E '^\s+Front Left') | |
| MONO=$(amixer get Master | grep -E '^\s+Mono') | |
| if [[ $FRONT_LEFT == "" ]]; then |
This file contains hidden or 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
| To encrypt: gpg -c <source> | |
| To decyprt: gpg <filenmae> |
This file contains hidden or 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
| SeanMac:temp sean$ cat test-ip | |
| eth0 Link encap:Ethernet HWaddr 45:d3:49:60:f3:0b | |
| inet addr:151.242.64.171 Bcast:178.22.71.255 Mask:255.255.248.0 | |
| inet6 addr: fe80::20c3:b4ff:fe6b:1fbb/64 Scope:Link | |
| UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 | |
| RX packets:165709690 errors:0 dropped:0 overruns:0 frame:0 | |
| TX packets:17210384 errors:0 dropped:0 overruns:0 carrier:0 | |
| collisions:0 txqueuelen:1000 | |
| RX bytes:20384657573 (20.3 GB) TX bytes:5304687858 (5.3 GB) |
This file contains hidden or 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
| syntax on | |
| filetype indent plugin on | |
| set background=light | |
| autocmd FileType ruby set autoindent|set smartindent | |
| autocmd FileType ruby set number | |
| autocmd FileType ruby set tabstop=4|set shiftwidth=4|set expandtab|set softtabstop=4 | |
| au FileType python set number |
This file contains hidden or 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
| openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mycert.key -out mycert.crt | |
| #openssl genrsa -out mykey.pem 2048 | |
| #openssl req -new -x509 -key mykey.pem -out mycert.crt -days 730 |
This file contains hidden or 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
| function sudo() { | |
| /usr/bin/sudo env PATH=${PATH} "$@" | |
| } |
This file contains hidden or 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 | |
| for i in $(seq 1 20); do | |
| echo slide $i | |
| sleep 15 | |
| xdotool click 1 | |
| done |
This file contains hidden or 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
| function verify_address(cidr_addr) { | |
| var parts = cidr_addr.split("/"); | |
| var ip = parts[0]; | |
| var prefix = parts[1]; | |
| var mask = 0xffffffff; | |
| var ip_parts = ip.split('.'); | |
| var ip_hex = (((((((+ip_parts[0])*256)+(+ip_parts[1]))*256)+(+ip_parts[2]))*256)+(+ip_parts[3])) >>> 0; | |
| var prefix_hex = (~(mask >>> prefix)) >>> 0; | |
| var net_addr = (ip_hex & prefix_hex) >>> 0; |
NewerOlder