Skip to content

Instantly share code, notes, and snippets.

View dky's full-sized avatar
馃崪

dky

馃崪
View GitHub Profile
@dky
dky / gist:4455542
Last active December 10, 2015 15:41
Perl one liner to delete all comments from file. Useful if you can't use sed on Solaris.
perl -p -i -e 's/#.*//' file_name
@dky
dky / gist:4455578
Last active December 10, 2015 15:38
Perl one liner to delete empty lines
perl -p -i -e 's/^\s*$//' file_name
@dky
dky / gist:4477658
Created January 7, 2013 19:26
Calculating swap usage on Solaris based on percentage free
swap -l | tail -1 | awk '{ printf("%.2f\n", 100 * ($5/$4))}'
@dky
dky / gist:4478205
Last active December 10, 2015 18:58
Oracle zones, escape sequence inside of a zone.
~.
@dky
dky / gist:4484509
Created January 8, 2013 15:10
Change the default port that Splunk listens on
/opt/splunk/bin/splunk set web-port 80 && /opt/splunk/bin/splunk restart
@dky
dky / gist:4485099
Created January 8, 2013 16:20
Red Hat apache log rotation
/var/log/httpd/*log {
missingok
notifempty
sharedscripts
postrotate
/bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true
endscript
}
@dky
dky / gist:4513096
Created January 11, 2013 19:07
Creating a directory in Pupppet
file { "/root":
ensure => "directory",
owner => "root",
group => "root",
mode => 750,
}
@dky
dky / gist:4527963
Created January 14, 2013 05:42
mysqldump backup a single table
mysqldump -u root -p database table_to_dump > table_to_dump.mysql
@dky
dky / gist:4540925
Created January 15, 2013 18:44
ps listing of Solaris projects
ps -ef -o pid,user,zone,project,taskid,args
@dky
dky / gist:4541581
Last active December 11, 2015 03:58
Puppet case parameter class to manage SSH
class module::params {
case $operatingsystem {
Solaris: {
$ssh_package_name = 'openssh'
}
/(Ubuntu|Debian)/: {
$ssh_package_name = 'openssh-server
}
/(RedHat|CentOS|Fedora)/: {
$ssh_package_name = 'openssh-server'