View subresource-integrity-generater.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'digest' | |
require 'base64' | |
WD = ARGV[0] | |
# sha256 sha384 sha512 | |
HASH_ALGO = "sha384" | |
allow_file_type = [".css", ".js"] | |
short_hash_length = 7 |
View esp32_am2320_sender.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <WiFi.h> | |
#include <HTTPClient.h> | |
#include <Ticker.h> | |
#include <Adafruit_Sensor.h> | |
#include <Adafruit_AM2320.h> | |
// Network | |
const char* ssid = "YOUR_SSID"; // 2.4GHz ONLY | |
const char* password = "YOUR_PASS"; | |
const char* influxdb_addr = "http://192.168.0.210:8086"; |
View random_cake.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 銀座コージーのカットケーキをランダムに選ぶ | |
require 'open-uri' | |
require 'nokogiri' | |
def cakes | |
domain = 'https://www.cozycorner.co.jp/' | |
url = 'https://www.cozycorner.co.jp/product/cutcake/' | |
charset = nil | |
html = URI.open(url) do |f| |
View HomeEnv.1m.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# coding: utf-8 | |
# <bitbar.title>HomeEnv</bitbar.title> | |
# <bitbar.version>v0.1</bitbar.version> | |
# <bitbar.author>Coro365</bitbar.author> | |
# <bitbar.author.github>Coro365</bitbar.author.github> | |
# <bitbar.desc>Display home environment from influxdb</bitbar.desc> | |
# <bitbar.image></bitbar.image> | |
# <bitbar.dependencies>ruby, influxdb</bitbar.dependencies> |
View pleroma-backup.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local_path="/home/pi/Documents/pleroma-backup" | |
remote="zunda" | |
remote_path="/Users/coro/Documents/pleroma-backup" | |
today=`date "+%Y%m%d-%H%M%S"` | |
pgdp_path=""$local_path"/plbk-"$today".pgdump" | |
sftp_path=""$local_path"/sftp.bat" | |
echo "Backup pg" |
View afp_video.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'open-uri' | |
require 'fileutils' | |
def add_log(recode) | |
recode = [Time.now, recode + "\n"].join(",\s") | |
File.write(File.join(__dir__, 'downlod.log'), recode, mode: 'a') | |
end | |
def load_log | |
File.open(File.join(__dir__, 'downlod.log')).read |
View reuters_video.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'open-uri' | |
require 'fileutils' | |
module Natural_sort | |
def natural_sort | |
zero_length = max_num_length_of(self) | |
number_formated_names = self.map do |data| | |
name_array = data.scan(/(\D*)(\d+)(\D*)/).flatten.reject(&:empty?) | |
name_array = [data] if name_array.empty? |
View add_filename.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_files_from_ARGV(recursive: true) | |
files = ARGV.map do |path| | |
path = File.expand_path(path) | |
if File.directory?(path) | |
if recursive | |
Dir.glob(File.join(path, '**', '*')) | |
else | |
Dir.glob(File.join(path, '*')) | |
end |
View add_margin_for_square.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def add_margin_for_square | |
images = get_files_from_ARGV | |
images.each_with_index do |file, i| | |
puts("[#{i}/#{images.size}]\t#{file}") | |
size = get_width_hight(file) | |
margin = margin(size) | |
if margin.first.zero? | |
puts("#{file} is square") | |
# TODO: create file-squre.jpg |
View hatena-fotolife-donwloder.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'open-uri' | |
require 'fileutils' | |
def set_username | |
return ARGV[0] if ARGV[0] | |
raise('Specify the user name in the argument.') | |
end | |
def get_photo_urls |
NewerOlder