This file contains hidden or 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 "twitter" | |
client = Twitter::REST::Client.new do |config| | |
config.consumer_key = "YOUR_CONSUMER_KEY" | |
config.consumer_secret = "YOUR_CONSUMER_SECRET" | |
config.access_token = "YOUR_ACCESS_TOKEN" | |
config.access_token_secret = "YOUR_ACCESS_SECRET" | |
end | |
screen_name = target_screen_name |
This file contains hidden or 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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# All Vagrant configuration is done below. The "2" in Vagrant.configure | |
# configures the configuration version (we support older styles for | |
# backwards compatibility). Please don't change it unless you know what | |
# you're doing. | |
Vagrant.configure("2") do |config| | |
# The most common configuration options are documented and commented below. | |
# For a complete reference, please see the online documentation at |
This file contains hidden or 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
module Ruboty | |
module Handlers | |
class Whoami < Base | |
on( | |
/who am i\?/i, | |
name: "whoami", | |
description: "Answer who you are", | |
) | |
def whoami(message) |
This file contains hidden or 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 'yaml' | |
require 'json' | |
yaml = YAML.load_file('abstract.yml') | |
json = JSON.pretty_generate(yaml) |
This file contains hidden or 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 'opencv' | |
include OpenCV | |
target_image = CvMat.load('search_target.png') | |
original_image = CvMat.load('original.jpg') | |
matching_result = original_image.match_template(target_image, :sqdiff) | |
puts "マッチング画像の元画像での座標の始点は次のとおりです" | |
puts "x: #{matching_result.min_max_loc[2].x}, y: #{matching_result.min_max_loc[2].y}" |
This file contains hidden or 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
# place /etc/apache2/sites-enabled/config_name_as_you_like.conf | |
# in this case, public directory is /mnt/hogehoge/apache2 | |
# and invalidate -> /etc/apache2/sites-available/000-default.conf | |
<VirtualHost *:20080> # set any port number | |
# The ServerName directive sets the request scheme, hostname and port that | |
# the server uses to identify itself. This is used when creating | |
# redirection URLs. In the context of virtual hosts, the ServerName | |
# specifies what hostname must appear in the request's Host: header to | |
# match this virtual host. For the default virtual host (this file) this |
This file contains hidden or 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 'mechanize' | |
def last_modified_at | |
agent = Mechanize.new | |
page = agent.get('http://img.amiami.jp/images/b/used_h.jpg') # TODO: SHOULD NOT BE HARD CORDING | |
last_modified_gmt = page.header['last-modified'] | |
last_modified_jst = Time.parse(last_modified_gmt).getlocal | |
end | |
puts last_modified_at #=> 2017-10-27 17:27:14 +0900 |
This file contains hidden or 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
#!/bin/bash | |
pdftoppm -png pdf_file.pdf output_filename | |
pdftoppm -jpeg pdf_file.pdf output_filename | |
pdftotext -layout pdf_file.pdf output_filename.txt | |
pdftotext -htmlmeta -layout pdf_file.pdf output_filename.html | |
# cf. pdf2htmlex https://github.com/coolwanglu/pdf2htmlex |
This file contains hidden or 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
#!/bin/bash | |
# https://github.com/oblique/create_ap | |
create_ap --ieee80211n wlx8857ee9a2350 eno1 106F3F0CC924_G SECRET_KEY & |
This file contains hidden or 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
#!/bin/bash | |
GIT_SSH_COMMAND="ssh -i ~/.ssh/my_key -F /dev/null" git clone [email protected]:foobar/hogehoge.git |