Skip to content

Instantly share code, notes, and snippets.

@keisei1092
keisei1092 / my_confs.json
Last active March 21, 2019 11:36
Karabiner-Elements configuration
{
"title": "my confs",
"description": "karabiner is god",
"rules": [
{
"description": "ctrl-m to enter",
"manipulators": [
{
"type": "basic",
"from": {
@keisei1092
keisei1092 / danbooru_downloader.rb
Created January 13, 2019 12:13
[WIP] Danbooru Downloader
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|

youtube-dl-cheetsheet

youtube-dlを使ってタスクを便利にこなすためのスニペット集

Pythonistaで使えるやつ

import youtube_dl, os, appex
@keisei1092
keisei1092 / wav2mp3.md
Last active June 30, 2018 14:57
指定したディレクトリにあるwavファイルを320kbpsのmp3ファイルに変換する

wav2mp3

指定したディレクトリにあるwavファイルを320kbpsのmp3ファイルに変換する
変換されたwavファイルは自動で削除します

Prerequisites

  • ffmpeg がインストールされていること
    • Homebrew がインストールされているmacOSなら brew install ffmpeg で入る
  • trash がインストールされていること
@keisei1092
keisei1092 / 20170507_tsunagarumirai_namecard.md
Last active August 26, 2017 15:47
Twiplaからスクレイピングして名刺作るやつ
@keisei1092
keisei1092 / 20170507_nico_playcount_share_tool.md
Last active May 7, 2017 04:09
ニコニコのマイリスから再生数を得るやつ

やれること

現在のマイリスの全体再生数をTwitterに投げる

やりたいこと

定期実行
遅延処理(getthumbinfoをディレイなしにリクエストしまくってる)
前回との変化分を表示
鯖に上げて誰でも使えるように

@keisei1092
keisei1092 / vocalonobis_watcher.rb
Created April 16, 2017 06:56
新着ツイートを監視してニコニコのURLを含んでいたらなにかするやつ
# 新着ツイートを監視してニコニコの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()
@keisei1092
keisei1092 / substitute.rb
Created February 24, 2017 02:05
複数ファイルの任意行の次に1行加えるやつ
#! /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