Skip to content

Instantly share code, notes, and snippets.

@wagyu298
wagyu298 / docker-ce-install.sh
Created October 17, 2017 03:41
Docker CE install script for Ubuntu-16.04 / AWS
#!/bin/bash
# Install Docker CE to Ubuntu-16.04 / AWS
# See https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/#install-using-the-repository for more details
sudo apt-get remove docker docker-engine docker.io
sudo apt-get update
sudo apt-get install -y \
linux-image-extra-$(uname -r | sed 's/-aws$//') \
linux-image-extra-virtual
sudo apt-get update
@wagyu298
wagyu298 / Podfile
Last active October 6, 2018 03:39
Adding local patch to Podfile
platform :ios, '8.0'
# Add this line to the headding of the Podfile
require './pod_patch'
target 'YourProject' do
pod 'PodNameForPatch'
# And add the patch instructions
pod 'PodNameForPatch'
@wagyu298
wagyu298 / detectmotionurl.js
Created May 12, 2017 05:41
AWS Rekognition detectModerationLabels example for Node.js
#!/usr/bin/env node
const request = require('request');
const AWS = require('aws-sdk');
const rekognition = new AWS.Rekognition({
// Detect moderation labels is available on AWS region us-east-1, us-west-2 and eu-west-1
region: "us-west-2",
accessKeyId: "YOUR accessKeyId",
secretAccessKey: "YOUR secretAccessKey"
@wagyu298
wagyu298 / docker_cleanup.sh
Created April 24, 2017 00:40
Cleanup all docker local copies
docker rm $(docker ps -a -q)
docker rmi $(docker images -q)
docker volume rm $(docker volume ls -q)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Usage:
# 1. Google Spread Sheet を開く
# https://docs.google.com/spreadsheets/d/1EKw-FI-zB_dPnIH-HM0OwlLwVkHluVlrGRyKIKtVMwg/edit?usp=sharing
# 2. Hero シートをコピーして hero.tsv に貼り付ける
# (TSV: Tab Separated Volume で)
# 3. Item シートをコピーして item.tsv に貼り付ける
# 4. Ability シートをコピーして ability.tsv に貼り付ける
APP_VERSION=`/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" MyApp/Info.plist
BUILD_NUMBER=`/usr/libexec/PlistBuddy -c "Print CFBundleVersion" MyApp/Info.plist
/usr/libexec/PlistBuddy \
-c "Set :CFBundleShortVersionString $APP_VERSION" \
-c "Set :CFBundleVersion $BUILD_NUMBER" \
MyExtension/Info.plist
@wagyu298
wagyu298 / mergeacknowledgements.py
Created October 23, 2016 06:22
Merge iOS Acknowledgements.plist files with CocoaPods
#!/usr/bin/env python
# Merge extra iOS App's Acknowledgements.plist into CocoaPods generated
# Acknowledgements.plist.
# Run "pip install dpath", s/MyApp/YourAppName/g, and replace extra_plist
# before use this script.
from __future__ import print_function
import operator
import plistlib
import sys
@wagyu298
wagyu298 / gist:5802089
Created June 18, 2013 01:58
This is a code snippet to control UITextView's contentInset.bottom and scrollIndicatorInset.bottom when iPhone's keyboard status is changed to visible or hide.
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
[notificationCenter addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
[notificationCenter addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
}
- (void)viewDidDisappear:(BOOL)animated
{
@wagyu298
wagyu298 / gist:6328430
Created August 24, 2013 14:22
1/30秒に1ピクセルMKMapViewを右にスクロールさせるサンプル
#import <MapKit/MapKit.h>
#import "ViewController.h"
@interface ViewController ()
@property (weak, nonatomic) IBOutlet MKMapView *mapView;
@property (strong, nonatomic) NSTimer *timer;
@end
@wagyu298
wagyu298 / gist:5822032
Created June 20, 2013 11:36
didFinishLaunchingWithOptions to kick ViewController.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
_window.rootViewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
[_window makeKeyAndVisible];
return YES;
}