Skip to content

Instantly share code, notes, and snippets.

@upgradeksh
upgradeksh / oneliner.sh
Created September 26, 2017 01:00
원라이너 with Perl
## sum of file size of found files
## convert byte to gigabyte
## using eskimo operator
find -type f -name "*.war" -o -name "*.tar" | perl -lne '$sum += -s }{ print $sum/1024/1024/1024'
@upgradeksh
upgradeksh / webservice-slack-webapi.pl
Last active July 4, 2016 05:05
sending slack attachment using by perl
#!/usr/bin/env perl
use utf8;
use strict;
use warnings;
use WebService::Slack::WebApi;
$ENV{HTTP_PROXY} = 'http://somewhere:8080';
@upgradeksh
upgradeksh / save-route.pl
Last active April 5, 2016 07:23
This script is to coded to save current route table to '/etc/sysconfig/network-scripts/route-#interface'
#!/usr/bin/env perl
#
# chkconfig: 2345 06 00
# description: this is to save the current routing table to a static route file
# called /etc/sysconfig/network-scripts/route-int0
#
use utf8;
use strict;
use warnings;
@upgradeksh
upgradeksh / buildsource.pp
Created March 8, 2016 12:47 — forked from reidmv/buildsource.pp
Puppet build define
#
# Depends on: puppetlabs/stdlib
#
define buildsource(
$dir = $title,
$user = 'root',
$path = '/usr/bin:/bin',
$timeout = '0',
$options = ''
) {
@upgradeksh
upgradeksh / types-standard.pl
Last active February 3, 2016 05:37
Moo with Types::Standard and Type::Tiny::Class
#!/usr/bin/env perl
use feature qw(say);
use utf8;
use strict;
use warnings;
package A::B::C {
use Moo;
#### salt-repo/init.sls
saltstack:
pkgrepo.managed:
- name: saltstack
- humanname: SaltStack repo for RHEL/CentOS $releasever
- baseurl: https://repo.saltstack.com/yum/rhel$releasever
- enabled: 1
- gpgcheck: 1
- gpgkey: file:///etc/pki/rpm-gpg/SALTSTACK-GPG-KEY.pub
@upgradeksh
upgradeksh / gist:5711083
Last active December 18, 2015 02:29
study oop
#!/usr/bin/env perl
use 5.014;
use utf8;
use warnings;
{
package Sorter;
sub new {
@upgradeksh
upgradeksh / gist:5683496
Last active December 17, 2015 22:39
print ascii character
#!/usr/bin/env perl
use 5.010;
use utf8;
use strict;
use warnings;
use LWP::Simple;
use URI::QueryParam;
@upgradeksh
upgradeksh / gist:5668232
Last active December 17, 2015 20:29
send grp msg with myppl api
#!/usr/bin/env perl
use 5.014;
use utf8;
use warnings;
# LWP::Protocol::https must be installed to request https
use LWP::UserAgent;
use URI::QueryParam;
@upgradeksh
upgradeksh / gist:5667351
Last active December 17, 2015 20:28
to compute the rate of seen alphabet
#!/usr/bin/env perl
use utf8;
use strict;
use warnings;
my %seen;
my $total;
while ( <> ) {
while (/([a-zA-Z])/g) {