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"
<html lang="ja">
<head>
<title></title>
<meta charset="UTF-8">
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/1.4.0/bootstrap.min.css">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
<script type="text/javascript" src="http://twitter.github.com/bootstrap/1.4.0/bootstrap-modal.js"></script>
<script type="text/javascript" src="http://www.zurb.com/javascripts/plugins/jquery.textchange.min.js"></script>
<script>
$(document).ready(function(){
@kkosuge
kkosuge / sample.php
Last active April 8, 2022 09:46
PHP <=> Ruby ( OpenSSL AES-256-CBC )
<?php
const PASSWORD = '!!!!!sufficiently_long_password!!!!!';
const CIPHER_METHOD = 'AES-256-CBC';
function encrypt($str) {
$iv_length = openssl_cipher_iv_length(CIPHER_METHOD);
$iv = mcrypt_create_iv($iv_length, MCRYPT_RAND);
$str = $iv.$str;
$val = openssl_encrypt($str, CIPHER_METHOD, PASSWORD, 0, $iv);
@kkosuge
kkosuge / route53DynDNS.bash
Created March 2, 2012 19:58
Amazon Route 53 Dynamic DNS Updater Script
#!/bin/bash
### User Settings (things you must set)
## Location of the dnscurl.pl script
DNSCurl="/path/to/route53DynDNS/dnscurl.pl"
## The host name you wish to update/create
myHostName="*"
## Zone/domain in which host (will) reside(s)
myDomainName="example.com"
@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",
require "open-uri"
require "nokogiri"
require "pp"
base_url = "http://dribbble.com"
@file = File.open('dribbble_profile_urls.txt','w')
def get_web_link(url)
doc = Nokogiri::HTML(open(url))
doc.css('.profile-details .url').each do |link|
@kkosuge
kkosuge / 最近のタイムライン保存事情.md
Created November 19, 2011 14:46
最近のタイムライン保存事情

最近のタイムライン保存事情

TwitterのタイムラインはJSONで流れてくるので、JSONぽい形式でデータを突っ込むMongoDBと相性が良い。
今まではtimeline.logとして書き出してたけど、GB単位に膨らんだテキストファイル重すぎて扱いづらいし最近は専らMongoDBに流し込んでます。
全部保存しとくと、誰がいつどのtweetを消したとか分かって異常に便利。こわい。
全文検索したいときがあるので、ツイイトはわかち書きでsplitして配列としても入れといてます。
MongoDBは配列で保存出来て、配列内にインデックスを貼れるので、簡単にいい感じの検索機能が作れて楽しいですね。
TLの全保存やってる人自体はそこら中に居るだろうし目新しいことは特にないでした。

@kkosuge
kkosuge / 都道府県.csv
Created December 13, 2011 10:07
都道府県.csv
北海道 青森県 岩手県 宮城県 秋田県 山形県 福島県 茨城県 栃木県 群馬県 埼玉県 千葉県 東京都 神奈川県 新潟県 富山県 石川県 福井県 山梨県 長野県 岐阜県 静岡県 愛知県 三重県 滋賀県 京都府 大阪府 兵庫県 奈良県 和歌山県 鳥取県 島根県 岡山県 広島県 山口県 徳島県 香川県 愛媛県 高知県 福岡県 佐賀県 長崎県 熊本県 大分県 宮崎県 鹿児島県 沖縄県
use strict;
use warnings;
use Compress::Raw::Zlib;
my $file_name = shift;
my $opt_name = "glitched_".$file_name;
open (FH, $file_name) or die "$!";
binmode FH;
my $hoge = *FH;