Skip to content

Instantly share code, notes, and snippets.

View ryochin's full-sized avatar
🏠
Working at home

Ryo Okamoto ryochin

🏠
Working at home
View GitHub Profile
@ryochin
ryochin / rsnapshot.conf
Created January 21, 2017 10:21
rsnapshot.conf
config_version 1.2
snapshot_root /mnt/rsnapshot/
retain hourly 24
retain daily 7
retain weekly 4
retain monthly 12
retain yearly 10
logfile /var/log/rsnapshot.log
@ryochin
ryochin / rsnapshot.patch
Last active January 30, 2017 03:17
rsync on first sync patch for rsnapshot 1.4.2.
--- a/rsnapshot
+++ b/rsnapshot
@@ -3470,14 +3470,14 @@ sub rotate_lowest_snapshots {
if (-d "$config_vars{'snapshot_root'}/.sync") {
print_cmd(
- "mv",
+ "rsync -a --link-dest=../.sync/",
"$config_vars{'snapshot_root'}/.sync/",
"$config_vars{'snapshot_root'}/$interval.0/"
@ryochin
ryochin / nicolive.coffee
Created August 14, 2017 12:55
nicolive alert to slack
# Description:
# NicoLiveAlert
# https://github.com/fagai/nicolive-alert-slack
'use strict'
module.exports = (robot) ->
require('dotenv').config silent: true
room = 'news'
@ryochin
ryochin / htpdate_https.patch
Last active May 10, 2019 10:51
https patch for htpdate 1.2.0
diff --git a/Makefile b/Makefile
index 1c80c09..841eb2b 100644
--- a/Makefile
+++ b/Makefile
@@ -4,6 +4,7 @@ mandir = ${prefix}/share/man
CC = gcc
CFLAGS += -Wall -std=c99 -pedantic -O2
+LIBS = -lssl -lcrypto
@ryochin
ryochin / Dockerfile
Created January 24, 2018 06:43
monacoin cpu miner on docker
FROM debian:stable-slim
ENV APP_DIR /app
WORKDIR $APP_DIR
RUN cp -p /usr/share/zoneinfo/Japan /etc/localtime
RUN apt-get update && apt-get install -y \
build-essential libssl-dev libcurl4-openssl-dev libjansson-dev zlib1g-dev automake autotools-dev git
@ryochin
ryochin / generate_password.coffee
Created March 9, 2018 04:16
simple but practical js password generator
# npm install lodash
# coffee -bc generate_password.coffee && node ./generate_password.js
`const _ = require('lodash')`
charList = "abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ123456789" # omit o,O,0
symbolList = "._-=[]{}+#^!?"
symbolListEscaped = _.reduce symbolList.split(''), ((r, s) -> r += "\\#{s}"), ''
@ryochin
ryochin / Proxy.pm
Created May 22, 2018 07:11
Plack::Middleware::Auth::Digest::Proxy
package Plack::Middleware::Auth::Digest::Proxy;
use 5.008001;
use strict;
use warnings;
use parent qw/Plack::Middleware::Auth::Digest/;
use URI;
our $VERSION = '0.01';
sub call {
@ryochin
ryochin / setup_chef.sh
Last active August 26, 2018 06:34
chef-solo initialization script for CentOS7
#!/bin/sh
# for CentOS7
case $# in
1)
REMOTE_HOST=$1
;;
*)
echo "usage: $0 <remote host>"
exit 1
#!/usr/bin/env ruby
class Main
require 'net/http'
require 'fileutils'
require 'thwait'
def initialize
@dir = './chunked_data'
@ryochin
ryochin / check_ssllabs
Created November 6, 2018 06:42
Nagios plugin to check ssllabs grade
#!/usr/bin/env perl
#
# required: https://github.com/ssllabs/ssllabs-scan
use strict;
use warnings;
use lib "/usr/local/nagios/libexec";
use vars qw($opt_H);
use Getopt::Long;