youtube-dlを使ってタスクを便利にこなすためのスニペット集
import youtube_dl, os, appex| { | |
| "title": "my confs", | |
| "description": "karabiner is god", | |
| "rules": [ | |
| { | |
| "description": "ctrl-m to enter", | |
| "manipulators": [ | |
| { | |
| "type": "basic", | |
| "from": { |
| require 'httparty' | |
| dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'downloaded')) | |
| response = HTTParty.get 'https://gelbooru.com/index.php?page=dapi&s=post&q=index&tags=hatsune_miku&json=1' | |
| response | |
| .parsed_response | |
| .map { |r| { r['file_url'] } } | |
| .tap { |r| puts r } | |
| # .each { |u| |
指定したディレクトリにあるwavファイルを320kbpsのmp3ファイルに変換する
変換されたwavファイルは自動で削除します
brew install ffmpeg で入るhttps://twitter.com/keisei_1092/status/861206475472904193
main.rb
require 'sinatra'| # 新着ツイートを監視してニコニコのURLを含んでいたらなにかするやつ | |
| # | |
| # Usage | |
| # gem install tweetstream | |
| # CONSUMER_KEY= CONSUMER_SECRET= OAUTH_TOKEN= OAUTH_SECRET= ruby vocalonobis_watcher.rb | |
| require 'tweetstream' | |
| class String | |
| def includesNicoUrl? |
| <!DOCTYPE html> | |
| <html style="height: 100%;"> | |
| <head> | |
| <title>skyline</title> | |
| </head> | |
| <body style="background-color: #F2F2F2; height: 100%; padding-left: 10%; padding-right: 10%;"> | |
| <textarea style=" | |
| margin: 0; | |
| border: none; | |
| width: 100%; |
| import XCPlayground | |
| import UIKit | |
| class ViewController: UIViewController { | |
| var button: UIButton? | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| view.backgroundColor = .white | |
| setupButton() |
| #! /Users/keisei/.rbenv/shims/ruby | |
| `git grep -lE '(let|var) request'`.split(/\n/).each do |filename| | |
| file = File.open(filename, 'r') | |
| buffer = file.read() | |
| buffer.gsub!(/((let|var) request = URLRequest\(url: urlPath\))/, '\1' + "\n\t\trequest.setValue(Configuration.clientIdentifier, forHTTPHeaderField: \"APP-CLIENT-VERSION\")") | |
| file = File.open(filename, 'w') | |
| file.write(buffer) | |
| file.close() | |
| end |