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
#!/usr/bin/env bash | |
# How-to: | |
# bash rand_str.bash {{optional length}} | |
# Source: https://www.tldp.org/LDP/abs/html/string-manipulation.html | |
LEN=$1 | |
if [ -z $LEN ]; then LEN=8; fi |
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 'faraday' | |
# Valid formats: html, doc, docx, epub, odt, pdf, txt | |
def get_doc_as(doc_id, type='html') | |
Faraday.get("https://docs.google.com/document/d/#{doc_id}/export?format=#{type}").body | |
end |
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
# percent(55, 556) | |
# => "09.89%" | |
def progress_as_percentage(i, total) | |
"%05.2f%%" % (100.0*i/total) | |
end |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<style> | |
.spoiler-hidden { background-color: gray; color: gray; cursor: pointer; } | |
</style> | |
</head> | |
<body> | |
<p class="spoiler">CONTENT FLAGS: Clowns, Rich People, Extended Sounds Of Brutal Pipe Murder</p> |
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 'json' | |
# Extracts all UTF-8 strings from YouTube's closed caption (`timedtext`) JSON | |
# object to generate a rough transcript. | |
# | |
# Instructions for acquiring the JSON: | |
# | |
# 1. Open the video in a new Firefox tab. Don't click "CC" yet. | |
# | |
# 2. Open Firefox Developer Tools (right-click somewhere and select "Inspect |
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
# Checks whether a value is an integer, should work in Ruby 2.6 and above. | |
# (Relies on `Float()` permitting `exception: false`: | |
# <https://rubyreferences.github.io/rubychanges/2.6.html#numeric-methods-have-exception-argument>) | |
def is_integer?(val) | |
flt = Float(val, exception: false) | |
return flt && flt.to_i==flt | |
end | |
def is_number?(val) | |
return !!Float(val, exception: false) |
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
# This isn't the official Ruby Tumblr client, it's a clone that accepts some extra arguments | |
require_relative 'lib/tumblr_client' | |
@credentials = YAML::load(File.read('credentials.env.yml')) | |
@client ||= TumblrClient.new(**@credentials) | |
@info ||= @client.user_info[:user] | |
@uuid ||= @info[:blogs].first[:uuid] | |
@username ||= @info[: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
require 'yaml' | |
require 'faraday' | |
require 'nokogiri' | |
# REVIEW: May not work for directories with larger numbers of files. | |
# REVIEW: Formatting will likely be different for non-Google-Docs files. | |
# REVIEW: This is stupid. | |
def scrape_folder_contents(gdrive_folder_url, output_fname=nil) | |
html = Faraday.get(gdrive_folder_url).body | |
doc = Nokogiri::HTML(html) |
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
--- | |
亜: [|,一,口] | |
唖: [|,一,口] | |
娃: [女,土] | |
阿: [一,口,亅,阡] | |
哀: [衣,口,亠] | |
愛: [心,爪,冖,夂] | |
挨: [矢,厶,扎,乞] | |
姶: [一,口,女,个] | |
逢: [|,込,二,夂] |
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
--- | |
一: 亜唖阿姶悪芦或袷夷椅畏異遺井郁一芋蔭陰右窺丑云雲盈益榎円延援演塩汚央岡下何可夏寡歌河珂苛荷華嘩画悔開碍垣劃隔岳橿恰且樺釜栢萱瓦乾寒干桓漢環看緩還関含基奇寄希棄稀貴輝騎儀宜犠義蟻誼議丘朽求給虚亨供共彊興尭業極桐僅勤琴衿吟倶駈具勲君薫群郡刑啓型形恵慧荊倹兼券喧圏拳捲研肩遣乎戸雇顧互碁乞光后宏巧恒晃更梗構洪溝硬紘綱肱講購閤号合今佐左査再最塞妻才犀在材財肴咲崎埼碕作柵冊三参惨珊蚕伺使司嗣屍師施死至詞事慈滋爾璽磁雫写斜遮若惹寿拾重春所叙序徐除傷症称証象鉦上丈丞乗剰場擾杖畳蒸飾慎晋榛真秦甚笥垂睡衰錘随髄世征政整正席惜昔籍宣扇煎煽箭前岨措狙疎祖租粗組阻創倉喪奏爽曹槍槽漕争糟葬蒼送遭鎗像束速袖其揃存唾堕惰楕体帯戴泰宅托託諾但巽丹嘆坦担旦歎湛胆壇断暖檀段値置窒昼苧貯丁庁暢町腸頂勅直朕鎮陳槻椿潰壷低停汀訂釘鼎迭典天展添殿澱塗途砺度凍唐塔塘搭東棟湯灯答筒董蕩藤謄騰働動同洞胴銅峠得凸寅乍弐廿禰寧年念捻乃嚢濃膿農覗廃拝杯盃曝爆函肇鉢髪蛤挽否扉畢逼紐百評病蛭浜賓瓶不富冨布怖普譜撫舞蕪副復幅福腹淵糞丙併兵塀柄並閉偏篇編遍便鞭俸奉峰峯捧縫蓬蜂豊鋒房暴棒奔本鮪柾俣抹末万満湊蓑稔無命免餅戻矢鑓愉愈諭輸佑優友宥憂有祐郵雄予余与誉預揚楊陽翼欄蘭吏了両糧量領倫臨輪涙令伶冷嶺怜玲苓鈴零霊麗齢煉錬炉婁蝋論歪賄亙亘弌丐丕亊亞亳亶仗佇佩佰侑來侖倚會偈偸僉僵儉兀兩兪册冉冓冱剏剄剞剪剳劍劔劒匐匱匳卅卍厦叮咀哄哈哥唏哽唸唳喘喩嗄嘸嚥囂囹囿圜圷坏垪堊堙塲墟壙壤壺壼壽竒妲妍娉婀媾嫣孃孳孺實寰專尹屏岑妛岻峇峺崋嵜崙崘嶮巵帶并廈廡廳弖彁彌徑忸忝恠怎怛恆恫惡惠愃愴慯慝憙憮懣戛戞扁拔抔拿拱拵掎掵捩揄搴搆搶擅舉攀敍敘數斂昊昜晉晞晝暄暘曁曄曩朞朮朿杤枦枅柯檜桎栫梹梺椏棊棗棯椪椣棆楡寨樓橢檢櫃檸欷欹歛歟殤氈沍洽浤涵淆淒淪湲湎滿渝滄滬滯澑澪濔瀑瀰瀲炳烝焉煖煬爨爰犲狃猗獪獸璢瑜瑾瓸甦甼畫畭畸疆畴疔疸痞痾瘍瘉瘡瘻癸盒盪蘯盻眄瞞瞶瞼矗矜碣祠祗祓禪禮禳秉秡秣稱穰窘窶竡笨笄箚篝簑簔篳簍篶簣簽籥粐粤粭粡粨粳鬻絨絣綺綮綸綟緻縣縉縷繖繪罔罘羚羶翕翦翩聆聘胚隋腆胼膓膾膸臉與艙艚舮苒苴莓茉荐荅莟莖茣荼萓菫蒹蓆蓴蔗蔕蕘薈薑藪藉乕號虱蚩蚌蚯蛉蛬蜍蝨蝙蝓蝪螻蠹衄衙衾袒裲褄褊襄褸覦覯觴訶諠諞謌謇諡譁譴讌讓豺貪賚賽跚跋踰蹇蹌蹠蹣蹕軆輊輌輳辷邇逕迸逾遘隨邱扈酊醋醢醴釀鈕錏鍮鎭鏤鈩鑰閂閧陏陲險霰靼鞳頷顫颪餘饉饋騁駢騙騫驗髏髓髯鬟鯑鯰鱠鴒鴿鵲鷓黔黻齡龕龠堯槇 | |
|: 亜唖逢悪以伊遺井稲印引鵜丑渦円焔艶押横沖下果 |