Skip to content

Instantly share code, notes, and snippets.

View toruuetani's full-sized avatar

Toru Uetani toruuetani

View GitHub Profile
tasks:
default:
vars:
LINE:
sh: task -l ^| peco
COLON:
sh: tmp="{{.LINE}}"; list=(${tmp/,/ }); echo ${list[1]}
TASK:
sh: tmp="{{.LINE}}"; list=(${tmp/,/ }); echo ${list[1]:0:-1}
DUMMY:

管理者権限で powershell を起動して、以下のコマンドを実行する。

Set-ExecutionPolicy Unrestricted
. { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
Install-BoxstarterPackage -PackageName "https://gist.githubusercontent.com/toruuetani/bc76abf2cc69b42d91bdcf815409040c/raw/311d8f3aa8c4f7756a50f390c074f5a346b9183e/boxstarter.txt" -DisableReboots
@toruuetani
toruuetani / test_pkd_fwd.c
Created April 3, 2017 05:24
lora_pkt_fwd.c ロジック検証コード
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#include <sys/time.h>
#define TX_MAX_ADVANCE_DELAY ((3 + 1) * 128 * 1E6) /* Maximum advance delay accepted for a TX packet, compared to current time */
#define TX_MAX_ADVANCE_DELAY_UL ((3UL + 1UL) * 128UL * 1000000UL)
int main(void){
@toruuetani
toruuetani / record.go
Created January 14, 2017 17:50
Prepend content to file by golang
package main
import (
"bufio"
"fmt"
"log"
"os"
)
func main() {
//
// Promise.swift
// TestApp
//
// Created by toruuetani on 2016/05/17.
// Copyright © 2016年 ryoden. All rights reserved.
//
import Foundation
@toruuetani
toruuetani / UIViewControllerWithPickerView.swift
Created April 14, 2016 07:31
UITextField でキーボードの代わりに UIPickerView を表示
class TestViewController: UIViewController {
private var pickerView: UIPickerView!
private var pickerViewToolbar: UIToolbar!
private var pickerViewSelectedRow: Int?
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
override func viewDidLoad() {
@toruuetani
toruuetani / autoupdater.md
Created March 15, 2016 09:17
AutoUpdater 構想

AutoUpdater 構想

  • 起動したら自分自身がサービス化されているかチェックする。
  • サービス化されていない場合は、サービスとして登録する。
  • 対象とする実行モジュールが最新かどうかモジュール配付サイトに問い合わせる
  • 最新かどうかは実行モジュールのハッシュ値で判断する。
  • 最新でない場合は実行モジュールを tmp にダウンロードする。
  • 実行モジュールの最新版ダウンロードが完了したら実行モジュールを置き換える。
  • 実行モジュールを起動する。
  • 起動後は定期的に対象プロセスを監視して、停止している場合は起動する。
  • 特定のロックファイルが存在する場合、プロセス再起動は行わない。
@toruuetani
toruuetani / ViewController.swift
Created March 10, 2016 08:25
バーコード読取 by AVFoundation
import UIKit
import AVFoundation
class BarcodeEncodingViewController: UIViewController {
private let session = AVCaptureSession()
private var prevLayer: AVCaptureVideoPreviewLayer!
private var hView = UIView()
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
2016-03-04 17:01:22.452 ParkingDemo[4049:2668694] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(
"<NSLayoutConstraint:0x1366aa540 H:[_UIButtonBarStackView:0x1366a4c40(<=0)]>",
"<NSLayoutConstraint:0x1366a5940 'UIView-leftMargin-guide-constraint' H:|-(5)-[UILayoutGuide:0x1366a5770'UIViewLayoutMarginsGuide'](LTR) (Names: '|':_UIButtonBarStackView:0x1366a4c40 )>",
"<NSLayoutConstraint:0x1366a59e0 'UIView-rightMargin-guide-constraint' H:[UILayoutGuide:0x1366a5770'UIViewLayoutMarginsGuide']-(5)-|(LTR) (Names: '|':_UIButtonBarStackView:0x1366a4c40 )>"
)