Skip to content

Instantly share code, notes, and snippets.

View kissrobber's full-sized avatar

kissrobber kissrobber

View GitHub Profile
with SampleAssistant(lang, device_model_id, device_id,
conversation_stream, display,
grpc_channel, grpc_deadline,
device_handler) as assistant:
wait_for_user_trigger = not once
import snowboydecoder
model = 'resources/models/anpanman.pmdl' # アンパンマンのホットワードモデル
detector = snowboydecoder.HotwordDetector(model, sensitivity=0.5)
@kissrobber
kissrobber / gist:7de78d3e877e2dda8d4aa573a75a992c
Created October 30, 2017 13:34
Get all association class_name of all Models in Rails
Rails.application.eager_load!
ActiveRecord::Base.descendants.each do |model|
model.reflect_on_all_associations.each do |association|
begin
klass = model.reflect_on_association(association.name).klass
p "#{model.name} #{klass.name}"
rescue
p "error: #{model.name} #{association.name}"
end
end
@kissrobber
kissrobber / migrate_with_sql.rake
Created July 22, 2016 04:53
/lib/tasks/migrate_with_sql.rake
namespace :db do
desc 'Make migration with output'
namespace :migrate_with_sql do
task(:down => :environment) do
ActiveRecord::Base.logger = Logger.new(STDOUT)
Rake::Task['db:migrate:down'].invoke
end
task(:up => :environment) do
ActiveRecord::Base.logger = Logger.new(STDOUT)
Rake::Task['db:migrate:up'].invoke
@kissrobber
kissrobber / graph_database_memo.md
Last active April 16, 2018 02:36
Graph Database memo
@kissrobber
kissrobber / batch-youtube-dl.sh
Last active June 27, 2022 04:09
parallel download youtube videos
cat ./urls.txt | xargs -L 1 -P 4 youtube-dl -i --write-thumbnail -o "./%(uploader)s/%(title)s-%(id)s.%(ext)s" $line
// HOBBY AND CRAFTS - WEB ONLY
// var sites = [
// {
// name: "Michaels Stores",
// url: "http://www.michaels.com/"
// }, {
// name: "Hobby Lobby",
// url: "http://www.hobbylobby.com/home.cfm"
// }, {
// name: "Jo-Ann Fabric and Craft Stores",
public gist