Skip to content

Instantly share code, notes, and snippets.

View kkosuge's full-sized avatar
🐇
busy

Kosuge Kazuya kkosuge

🐇
busy
View GitHub Profile
function ??
github-copilot-cli what-the-shell -- "$argv"
end
function git_
github-copilot-cli git-assist -- "$argv"
end
function gh_
github-copilot-cli gh-assist -- "$argv"
@kkosuge
kkosuge / uhk.json
Last active May 1, 2021 06:11
Changing mouse motion to scroll when the left mouse button is pressed in UHK Trackpoint module
{
"title": "Configurations for UHK Trackpoint module",
"rules": [
{
"description": "pointing_button(button1) to enable mouse_motion_to_scroll",
"manipulators": [
{
"type": "basic",
"from": {
"pointing_button": "button1",
@kkosuge
kkosuge / .env
Created July 24, 2017 03:19
Slack のステータス変更スクリプト
SLACK_TOKEN=lgsolashdgoalisdhgaldgahksdg
@kkosuge
kkosuge / crawler.rb
Created December 29, 2015 04:20
取ってきた HTML のエンコーディング化かさないようにするやつ
require 'open-uri'
require 'nkf'
require 'nokogiri'
user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586'
html = open(url, 'User-Agent' => user_agent).read
unless html.encoding.name == 'UTF-8'
html.encode!('UTF-8', NKF.guess(html).name, invalid: :replace, undef: :replace)
end
@kkosuge
kkosuge / README.md
Last active March 26, 2016 18:14
ウェブサイト記事の本文に含まれる画像URLを抽出するやつ
# Gemfile
gem "extract_content_images", git: "https://gist.github.com/61b3d029a4f4b74f6244.git", require: "extract_content_images"
require "extract_content_images"

url = 'http://blog.kksg.net/posts/%E5%B0%8F%E7%AC%A0%E5%8E%9F%E8%AB%B8%E5%B3%B6'
html = open(url).read
rails s | grep -v '/assets/'
@kkosuge
kkosuge / gist:7b86d9ab7b48b46f810f
Last active December 7, 2015 11:46
Tweetman のツイートボックスに URL とタイトルをセットするブックマークレット https://tweetman.kksg.net/
javascript:window.location='tweetman:///post?text='+encodeURIComponent('Now Browsing: ')+encodeURIComponent(document.title)+encodeURIComponent(' ')+encodeURIComponent(window.location.href)
@kkosuge
kkosuge / prev_page_view.rb
Last active December 6, 2015 02:17 — forked from soramugi/Gemfile
GoogleAnalyticsに登録してるサイト全ての昨日のPV数出すやつ
#!/usr/bin/env ruby
# -*- encoding: utf-8 -*-
# 参考
# http://qiita.com/kazuph/items/2cf81a84985e894e9682
# http://bekkou68.hatenablog.com/entry/2014/08/20/222032
#
# api試すページ
# https://developers.google.com/apis-explorer/#s/analytics/v3/
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->