Skip to content

Instantly share code, notes, and snippets.

Avatar

Likkradyus Likk

View GitHub Profile
@Likk
Likk / datetime2.cfml
Created Aug 28, 2019
ColdFusion で日付処理
View datetime2.cfml
<cfset localDate = now()>
<cfset utcDate = DateConvert("Local2utc", localDate)>
<cfset epoch = DateDiff("s", "January 1 1970 00:00", utcDate)>
<cfset utime = 1371729285>
<cfoutput>
Local Date: #localDate# <br>
UTC Date: #utcDate# <br>
Epoch: #epoch# <br>
Time :#DateAdd("s", utime ,DateConvert("utc2Local", "January 1 1970 00:00"))# <br>
yymmdd24hmiss: #DateFormat(localDate, "yyyy/MM/dd")# #TimeFormat(localDate, "HH:mm:ss")#
@Likk
Likk / main.go
Last active Jul 3, 2019
GoのバイナリをPerl/Ruby/PHPスクリプトとしても扱う (元ネタ https://codehex.hateblo.jp/entry/2019/07/02/090000 https://uzulla.hateblo.jp/entry/2019/07/02/191859)
View main.go
package main
import (
"fmt"
"io/ioutil"
)
const script = `<?php
file_put_contents("php://stderr", "This is PHP world!!!".PHP_EOL);
__halt_compiler();
@Likk
Likk / slack_rtm_bot_test1.pl
Last active Mar 30, 2017
子プロセス無いで死ぬとその後継続しない
View slack_rtm_bot_test1.pl
use strict;
use warnings;
use utf8;
use Encode;
use Slack::RTM::Bot;
while(1){
my $bot = Slack::RTM::Bot->new(
token => 'XXXX',
options => +{ max_message_size => 20480 }
@Likk
Likk / slack.pl
Created Mar 24, 2017
Slack::RTM::Bot CLI viewer Raw
View slack.pl
use strict;
use warnings;
use utf8;
use Encode;
use Slack::RTM::Bot;
use Term::ANSIColor;
my $bot = Slack::RTM::Bot->new(
token => 'YOUR TOKEN',
);
@Likk
Likk / drop_merged_branch
Last active Aug 22, 2019
現在作業中のブランチにマージ済みのローカルブランチをローカルからもリモートからも消すワンライナー
View drop_merged_branch
git branch --merged | sed 's/\(^ \+\| \+$\)//g' | perl -nlE ' `git push --delete origin $_; git branch -d $_`'
@Likk
Likk / image_extract.pl
Last active Aug 29, 2015
use GD and extract image for perl
View image_extract.pl
sub image_extract {
my $gd_res = '';
my $file = shift;
my @def_rgb = (14, 16, 13);
my $gd = FromJpeg GD::Image->new($file);
my $dst = GD::Image->new(85, 30);
$dst->copy($gd, 0,0, 355, 265, 85, 30);
my ($ws, $we, $hs, $he) = (1,85, 2,30);
@Likk
Likk / slack_term.pl
Last active Mar 24, 2017
コマンドラインからslackチャット
View slack_term.pl
#!/usr/bin/perl
use strict;
use warnings;
use utf8;
use Carp;
use Config::Pit;
use DateTime;
use Encode;
@Likk
Likk / git_clean.pl
Last active Dec 17, 2015
対話式 git-clean
View git_clean.pl
#!/usr/bin/perl
use strict;
use warnings;
use utf8;
use feature ':5.10';
use Getopt::Long qw(GetOptions :config posix_default no_ignore_case bundling );
use Params::Validate qw/:all/;
use Pod::Usage 'pod2usage';
@Likk
Likk / WWW::Lingr
Last active Dec 14, 2015
Lingr スクレイピングやっつけ
View WWW::Lingr
package WWW::Lingr;
use strict;
use warnings;
use utf8;
use Carp;
use Encode;
use Try::Tiny;
use Web::Scraper;
use WWW::Mechanize;
@Likk
Likk / negatibot.rb
Created Sep 30, 2012
negatibot on wassr
View negatibot.rb
#!/usr/bin/ruby -Ku
require 'uri';
require 'net/http';
require 'rexml/document';
class Negatibot
def initialize
@message = nil
@dt = Time.now;
You can’t perform that action at this time.