Skip to content

Instantly share code, notes, and snippets.

View kshoji's full-sized avatar
💭
My mother fell ill & is currently hospitalized. I'm very busy dealing with her.

Kaoru Shoji kshoji

💭
My mother fell ill & is currently hospitalized. I'm very busy dealing with her.
View GitHub Profile
@kshoji
kshoji / Page renewal watcher
Created November 30, 2012 07:32
one liner shell scripts
yes 'curl "http://example.com/page/to/watch.html"|md5|perl -e "\$md5=<>;chop\$md5;if(\$md5 ne \"md5 hash string\"){system \"growl -s -H localhost -m renewed!\";}";sleep 60'|sh
@kshoji
kshoji / Activity_onDestroy.java
Created December 4, 2012 03:03
Android Advent Calender 2012
@Override
protected void onDestroy() {
super.onDestroy();
if (deviceDetachedReceiver != null) {
unregisterReceiver(deviceDetachedReceiver);
}
}
@kshoji
kshoji / mvn_snapshot.sh
Created December 5, 2012 08:45
Android maven configuration
mvn -DaltDeploymentRepository=package-name::default::file:snapshots clean deploy
@kshoji
kshoji / SpeechSample.java
Created December 11, 2012 02:02
Hentai Advent Calender 2012
TextToSpeech textToSpeech = new TextToSpeech(getApplicationContext(), new OnInitListener() {
@Override
public void onInit(int status) {
int result = status;
if (status == TextToSpeech.SUCCESS) {
result = textToSpeech.setLanguage(Locale.JAPAN);
if (result != TextToSpeech.LANG_MISSING_DATA && result != TextToSpeech.LANG_NOT_SUPPORTED) {
onInitSuccess();
return;
}
perl -e 'for(;$t<1<<19;$t++){print pack("C",((($t*(ord substr("F23K12YP.+0%sUGa",~$t>>12&15)))/3&15)-(((~(($t>>9)^($t>>10))%15*$t)/3|$t>>14)&152)));}' | /dev/audio
@kshoji
kshoji / appleDeveloperSystemStatus.pl
Created September 6, 2013 09:05
Shows the status of [Apple Developer System Status](https://developer.apple.com/support/system-status/).
#! /usr/bin/env perl
use warnings;
use strict;
use LWP::Protocol::https;
use Web::Scraper;
use YAML;
my $urlToScrape = "https://developer.apple.com/support/system-status/";
my $teamsdata = scraper {
@kshoji
kshoji / patch for Archive-Zip-Member.pm
Created October 30, 2013 08:30
Bug fix for the CPAN module Archive::Zip. The error `IO error: seeking to rewrite local header : Illegal seek` happened when write to the STDOUT.
# patch for Archive/Zip/Member.pm
# search the 'bitFlag' subroutine and replace it.
sub bitFlag {
my $self = shift;
# Set General Purpose Bit Flags according to the desiredCompressionLevel setting
my $hasDataDescriptor = $self->hasDataDescriptor();
if ( $self->desiredCompressionLevel == 1 || $self->desiredCompressionLevel == 2 ) {
$self->{'bitFlag'} = DEFLATING_COMPRESSION_FAST | $hasDataDescriptor;
@kshoji
kshoji / README.md
Created February 13, 2014 04:11
拝承プラットフォームに変換するChrome拡張

使いかた

  • manifest.json と script.js を適当な、同じディレクトリ内に保存します。
  • Chromeの設定画面を開き、拡張機能の画面を出します。
  • 「デベロッパーモード」のチェックボックスにチェックを入れます。
  • 「パッケージされていない拡張機能を読み込む」ボタンを押し、先程のディレクトリを選択します。
  • http://daishonin.hatelabo.jp/ を開きます。
@kshoji
kshoji / InitializeDestroy.java
Created April 8, 2014 05:25
'javax.sound.midi for Android' example code
public class MidiPlayingFragment extends Fragment {
private Sequencer sequencer = null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
MidiSystem.initialize(getActivity());
try {
@kshoji
kshoji / CentralProvider.java
Created April 10, 2015 03:00
Android BLE MIDI code snippets
public class CentralActivity extends Activity {
BleMidiCentralProvider bleMidiCentralProvider;
@Override
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
bleMidiCentralProvider = new BleMidiCentralProvider(this);