Skip to content

Instantly share code, notes, and snippets.

target_end=$(($(cat "/sys/block/mmcblk0/size") - 1))
sudo parted -m /dev/mmcblk0 u s resizepart 2 $target_end
sudo resize2fs /dev/mmcblk0p2
@KAMEDAkyosuke
KAMEDAkyosuke / response.json
Last active May 18, 2018 13:27
複数画像が含まれた tweet を https://api.twitter.com/1.1/statuses/show.json で取得した際のレスポンス
{"created_at":"Sun Feb 22 00:27:31 +0000 2015","id":569292363937349633,"id_str":"569292363937349633","text":"#\u6771\u4eac\u30de\u30e9\u30bd\u30f3 \u304c\u30b9\u30bf\u30fc\u30c8\uff01\n@Tokyo42195_org \u304b\u3089\u5927\u4f1a\u306e\u69d8\u5b50\u304c\u30c4\u30a4\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u3059\u3002\nRT @tokyo42195_org: \u8eca\u3044\u3059\u306b\u7d9a\u304d\u3001\u30de\u30e9\u30bd\u30f3\u30fb10km\u3082\u30b9\u30bf\u30fc\u30c8\u3057\u307e\u3057\u305f\u3002\u30d5\u30b8\u30c6\u30ec\u30d3\u7cfb\u5168\u56fd\u30cd\u30c3\u30c8\u3067\u653e\u9001\u4e2d\u3067\u3059\u3002 http:\/\/t.co\/LoEKszyJ2e","source":"\u003ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003eTweetDeck\u003c\/a\u003e","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":1159274324,"id_str":"1159274324","name":"Twitter Sports Japan","screen_name":"TwitterSportsJP","location":"To
#!/usr/bin/env python3
from http.server import BaseHTTPRequestHandler, HTTPServer
class MyHandler(BaseHTTPRequestHandler):
def do_GET(self):
print("headers : \n", self.headers)
self.send_response(200)
self.end_headers()
NSMutableArray<id> *items = [NSMutableArray array];
NSURL *url = [NSURL URLWithString:@"https://www.google.co.jp"];
NSString *text = @"hello world";
[items addObject:url];
[items addObject:text];
UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:items
applicationActivities:nil];
// select copy action
[self presentViewController:activityViewController
$ find . -type f -exec grep -nH -e NS_DEPRECATED_IOS\(.*,\ 10_2 {} +
./AVFoundation.framework/Headers/AVCaptureDevice.h:481:AVF_EXPORT AVCaptureDeviceType const AVCaptureDeviceTypeBuiltInDuoCamera NS_DEPRECATED_IOS(10_0, 10_2, "Use AVCaptureDeviceTypeBuiltInDualCamera instead") __TVOS_PROHIBITED;
NS_DEPRECATED_IOS
API_DEPRECATED_WITH_REPLACEMENT
WK_DEPRECATED_WATCHOS
NS_CLASS_DEPRECATED_IOS
NS_ENUM_DEPRECATED_IOS
API_DEPRECATED
__OSX_AVAILABLE_BUT_DEPRECATED
NS_DEPRECATED
__OSX_DEPRECATED
DEPRECATED_IN_MAC_OS_X
;; -*- coding:utf-8; mode:emacs-lisp; lexical-binding: t -*-
(require 'cl)
(defconst ragnarok-process "ragnarok-process")
(defvar ragnarok-service-port 1743)
(defun ragnarok-process-filter (process string)
"外部プロセスからのデータ取得"
(message "%s : %s" (process-name process) string))
@KAMEDAkyosuke
KAMEDAkyosuke / find-grep NS_AVAILABLE_IOS(10_3.sh
Last active March 29, 2017 03:08
find . -type f -exec grep -B 10 -nH -e ios\(10.3 {} +
$ find . -type f -exec grep -B 10 -nH -e NS_AVAILABLE_IOS\(10_3 {} +
./AVFoundation.framework/Frameworks/AVFAudio.framework/Headers/AVAudioSession.h-577-AVF_EXPORT NSString *const AVAudioSessionInterruptionOptionKey NS_AVAILABLE_IOS(6_0);
./AVFoundation.framework/Frameworks/AVFAudio.framework/Headers/AVAudioSession.h-578-
./AVFoundation.framework/Frameworks/AVFAudio.framework/Headers/AVAudioSession.h-579- /* Only present in begin interruption events, where the interruption is a direct result of the application being suspended
./AVFoundation.framework/Frameworks/AVFAudio.framework/Headers/AVAudioSession.h-580- by the operating sytem. Value is a boolean NSNumber, where a true value indicates that the interruption is the result
./AVFoundation.framework/Frameworks/AVFAudio.framework/Headers/AVAudioSession.h-581- of the application being suspended, rather than being interrupted by another audio session.
./AVFoundation.framework/Frameworks/AVFAudio.framework/Headers/AVAudioSession.h-582-
./AVFoundation.framework/
@KAMEDAkyosuke
KAMEDAkyosuke / gist:7577678
Last active December 28, 2015 23:19
AAC のハードウェアエンコーダーをサポートしているかどうかのチェック。
- (BOOL)isAACHardwareEncoderAvailable
{
OSStatus status;
UInt32 size;;
UInt32 encoderSpecifier = kAudioFormatMPEG4AAC;
status = AudioFormatGetPropertyInfo(kAudioFormatProperty_Encoders,
sizeof(encoderSpecifier),
&encoderSpecifier,
&size);
check_osstatus(status, @"AudioFormatGetPropertyInfo fail");
@KAMEDAkyosuke
KAMEDAkyosuke / gist:5697303
Created June 3, 2013 10:19
これで書けば http-sync を普通に node モジュールっぽく使える。
#!/bin/sh
mkdir node_modules
cd node_modules
git clone https://github.com/dhruvbird/http-sync.git
cd http-sync
node-gyp configure
node-gyp build
cp build/Release/curllib.node .