Skip to content

Instantly share code, notes, and snippets.

View mugifly's full-sized avatar
🏠
Working from home

Masanori Ohgita mugifly

🏠
Working from home
View GitHub Profile
@mugifly
mugifly / bg-colors.html
Created September 12, 2012 00:41
BGColors - multiple coloring in background-color by CSS3-gradient
<!DOCTYPE html>
<html>
<head>
<title>BGColors Sample</title>
<script type="text/javascript" src="bg-colors.js"></script>
<script type="text/javascript">
function sampleDraw(){
new BGColors(['red','green','blue','yellow'], document.getElementById('sample'));
}
</script>
@mugifly
mugifly / gist:4187031
Created December 2, 2012 05:01
Perl - Gmail IMAP Using OAuth 2.0 (XOAUTH2)
#!/usr/bin/env perl
# Perl - Gmail IMAP Using OAuth 2.0 (XOAUTH2)
# I referred to: http://eatenbyagrue.org/tags/oauth/index.html Thank you.
use strict;
use warnings;
use utf8;
use Mail::IMAPClient;
@mugifly
mugifly / daemon.pl
Created January 23, 2013 16:50
How to use the Morbo (include Mojolicious) as a simple http daemon. For example, it will be useful for doing development with XMLHTTPRequest(Javascript) on localhost.
#!/usr/bin/env perl
use Mojolicious::Lite;
push @{app->static->paths}, 'site/'; # File path
app->start('daemon');
# Execute this script on terminal: perl daemon.pl
# Then, let's access to http://localhost:3000/***
@mugifly
mugifly / angular-filters.js
Last active September 5, 2018 17:55
Angular JS little filters.
'use strict';
angular.module('foo', [])
.filter('substring', function() {
return function(str, start, end) {
return str.substring(start, end);
};
})
@mugifly
mugifly / backup-script-README.md
Last active December 22, 2021 22:02
backup-script.pl - Backup script for UNIX servers. (昔作った AmazonS3へのバックアップ用スクリプトです。一応動きますので公開しますw)

backup-script.pl - Backup script for UNIX servers.

Amazon S3へのバックアップ用スクリプトです。ディレクトリおよびMySQLデータベースのバックアップができます。

以前に作ったもので、やっつけ仕事で汚すぎるコードですが、一応動きますので公開しますw サーバのcrontabにでも登録してご自由にご利用ください。

ファイルシステムはSquashFSを用いてアーカイブされます (MySQLデータベースは、tar.gz)。

必要なパッケージ

  • CentOS/Fedora:
@mugifly
mugifly / github_webhook_updater.cgi
Last active December 14, 2015 12:38
GitHub Webhook receiver & updater cgi (for Hosting-web-server)
#!/usr/bin/env perl
# GitHub Webhook receiver & updater cgi (for Hosting-web-server)
# https://gist.github.com/mugifly/5087897/
use strict;
use warnings;
use utf8;
use lib 'lib'; # for local lib directory
use CGI;
@mugifly
mugifly / blink.css
Last active April 25, 2018 06:30
CSS Blink for Webkit and others. (Chrome, Safari, Firefox (Gecko), IE, ...) CSSで擬似的なblinkを再現する簡単なTips。
@mugifly
mugifly / bayon_simple_webapi.pl
Last active December 15, 2015 07:19
Bayon Simple WebAPI (with Mojolicious::Lite)
#!/usr/bin/env perl
# Bayon Simple WebAPI (with Mojolicious::Lite)
# https://gist.github.com/mugifly/5222608
use Mojolicious::Lite;
use utf8;
use Mojo::JSON;
use Mojo::ByteStream;
use Mojo::Asset::File;
use Text::Bayon;
use Encode;
@mugifly
mugifly / arduino_bluetooth-serial_led.ino
Last active December 20, 2015 22:59
スケッチ: "Arduino LeonardoによるBluetoothシリアル制御のLチカ" Arduinoのシリアル通信 および Bluetoothによるシリアル通信などから制御可能。 (0 = LED消灯, 1 = LED点灯, 2 = お遊び) http://masanoriprog.blogspot.jp/2013/08/arduino-bluetooth-serial-led.html
#include <SoftwareSerial.h>
#define LED_PORT 13
#define BT_RX 11
#define BT_TX 10
// TX(RBT-001) <-> 11(Arduino)
#define PWM_WIDTH 500
// roop = 2ms
@mugifly
mugifly / git-branch-clean.pl
Last active August 20, 2016 13:29
Git branch cleaner script - Delete a branches that not exist on remote repository. (perl 5.x)
#! /usr/bin/env perl
# Git branch cleaner ( Delete a branches that not exist on remote repository)
# If you have not ran the 'git fetch --plune' command, please try it before this script.
# Useful case (maybe): If can't delete a branches using 'git fetch --plune' command.
#
# Usage: $ perl git-branch-clean.pl --help
use warnings;
use strict;
use utf8;