Skip to content

Instantly share code, notes, and snippets.

View toshi0383's full-sized avatar
🏠
Working from home

Toshihiro Suzuki toshi0383

🏠
Working from home
  • Tokyo
View GitHub Profile
@orta
orta / _SQL.sql
Last active November 8, 2016 12:12
Top 300 Pods by Application Integrations
SELECT pods.name, stats_metrics.download_total, stats_metrics.download_week, stats_metrics.app_total, stats_metrics.app_week FROM stats_metrics JOIN pods ON stats_metrics.pod_id = pods.id ORDER BY app_total DESC LIMIT 300;
@inamiy
inamiy / reactiveswift.swift
Last active July 27, 2017 17:06
Rx "Hot -> Cold" + multiple subscription behavior
print("=== signal (hot) ===")
do {
let (signal, observer) = Signal<Int, NoError>.pipe()
let s = signal
.map { x -> Int in
print("map \(x)")
return x
}
s.observeValues { _ in }
@hoshi-takanori
hoshi-takanori / BinaryTree.swift
Last active March 24, 2019 21:04
Binary Tree in Swift 2.0.
//: Binary Tree
protocol CollectionTypeConvertible {
typealias T
var array: [T] { get }
}
class Node<T: Comparable> {
let value: T
var left: Node?
import Foundation
func dumpMemory(_ p: UnsafeRawPointer, _ size: Int) {
let addr = unsafeBitCast(p, to: UInt64.self)
var p = p.bindMemory(to: UInt8.self, capacity: size)
for i in 0..<size {
if i % 8 == 0 {
if i != 0 {
print()
}
@amokan
amokan / gist:3881064
Created October 12, 2012 19:36
jenkins-cli commands (v1.485)
build
Builds a job, and optionally waits until its completion.
cancel-quiet-down
Cancel the effect of the "quiet-down" command.
clear-queue
Clears the build queue
connect-node
Reconnect to a node
copy-job
Copies a job.
@kazuho
kazuho / git-blame-pr.pl
Last active June 28, 2022 07:15
git-blame by PR #
#! /usr/bin/perl
#
# Written in 2017 by Kazuho Oku
#
# To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.
# You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
#
use strict;
use warnings;
@marchampson
marchampson / collaborator api
Created January 28, 2013 14:11
Add collaborator from command line
curl -i -u "my_user_name:my_password" -X PUT -d '' 'https://api.github.com/repos/my_gh_userid/my_repo/collaborators/my_collaborator_id'
@imkevinxu
imkevinxu / Device.swift
Last active March 4, 2023 16:09
iOS device checks for OS version and screen size in Swift
//
// Device.swift
// imHome
//
// Created by Kevin Xu on 2/9/15. Updated on 6/20/15.
// Copyright (c) 2015 Alpha Labs, Inc. All rights reserved.
//
import Foundation
@sekati
sekati / xcode-build-bump.sh
Created July 24, 2012 20:44
Xcode Auto-increment Build & Version Numbers
# xcode-build-bump.sh
# @desc Auto-increment the build number every time the project is run.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0)
@ndarville
ndarville / diff.mdown
Created July 23, 2012 20:33
Paul Heckel's Diff Algorithm

[Isolating Differences Between Files][paper]

Advantage over Other Algorithms

The diff output is more specific:

[I]f a whole block of text is moved, then all of it, rather than just the beginning and end, is detected as changed.

>The algorithm described here avoids these difficulties. It detects differences that correspond very closely to our intuitive notion of difference.