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
http://www.cyberciti.biz/tips/shell-root-user-check-script.html | |
Sometime it is necessary to find out if a shell script is being run as root user or not. | |
When user account created a user ID is assigned to each user. BASH shell stores the user ID in $UID variable. Your effective user ID is stored in $EUID variable. You can | |
Old way... | |
You can easily add a simple check at the start of a script: |
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
require 'socket' | |
require 'nokogiri' | |
host = 'www.so.com' | |
port = 80 | |
path = "http://www.so.com/s?psid=aa1636dc9ced822ddb741bd94af183fc&q=%E8%89%BA%E9%BE%99&pq=%E8%89%BA%E9%BE%99&src=srp&fr=360sou_newhome" | |
request = "GET #{path} HTTP/1.0\r\n\r\n" | |
socket = TCPSocket.open(host, port) | |
socket.print(request) |
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
syntax on | |
" space | |
set expandtab | |
set tabstop=2 | |
set shiftwidth=2 | |
" EOL whitespace | |
set list | |
set listchars=trail:+ |
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
[alias] | |
unstage = reset HEAD | |
throw = reset --hard HEAD | |
throwh = reset --hard HEAD^ | |
st = status | |
ci = commit -v | |
co = checkout | |
br = branch | |
hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short | |
[color] |
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
install: "--no-rdoc --no-ri" | |
update: "--no-rdoc --no-ri" |
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
The ALLUSERS=1 switch worked. How do you know these things? :-) | |
I have no experience with installers. I searched Google, but I think I didn't even know what I needed to be searching for. Thanks for the help. | |
Don Jones · July 10, 2014 at 9:33 am #16975 | |
Don Jones | |
Keymaster |
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
%define path /usr/local/zabbix | |
%define real_name zabbix | |
Name:zabbix_server-ThoughtWorks | |
Version:2.2.3 | |
Release:1.centos | |
Summary:zabbix_server for ThoughtWorks | |
Group:System Environment/Daemons | |
License:GPL |
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 bash | |
yum install -y rpm-build | |
yum install -y tree | |
mkdir -p rpmbuild/BUILD rpmbuild/BUILDROOT rpmbuild/RPMS rpmbuild/SOURCES rpmbuild/SPECS rpmbuild/SRPMS | |
echo "######" | |
tree rpmbuild |
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 bash | |
uninstall() { | |
list=`gem list --no-versions` | |
for gem in $list; do | |
gem uninstall $gem -aIx | |
done | |
gem list | |
gem install bundler | |
} |
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
PUBLIC_IP="$(ifconfig eth0 | awk -F ' *|:' '/inet addr/{print $4}')" |
OlderNewer