This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## Usage | |
## app_icon_set_sips.sh Icon.png | |
mkdir -p icons 2>/dev/null | |
sips -z 20 20 --out icons/[email protected] $1 | |
sips -z 40 40 --out icons/[email protected] $1 | |
sips -z 60 60 --out icons/[email protected] $1 | |
sips -z 29 29 --out icons/[email protected] $1 | |
sips -z 58 58 --out icons/[email protected] $1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Usage | |
// yarn add puppeteer | |
// node puppeteer_sample.js | |
const puppeteer = require('puppeteer'); | |
puppeteer.launch({ | |
headless: false, // フルバージョンのChromeを使用 | |
slowMo: 300 // 何が起こっているかを分かりやすくするため遅延 | |
}).then(async browser => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.gh-header-meta .commit-ref:first-of-type:not([title*='master']) { | |
background: #dbab09; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# rails_restart.sh is simple shell program. you can get somewhere. | |
require 'webrick' | |
require 'json' | |
server = WEBrick::HTTPServer.new(Port: 8000, ServerType: WEBrick::Daemon) | |
server.mount_proc '/' do |req, res| | |
req_json = JSON.parse(req.body) | |
if req_json["ref"] == "refs/heads/master" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
</head> | |
<body> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> | |
<script type="text/javascript"> | |
$(function(){ | |
$('#more_load').bind('click', function() { | |
var offset = $(this).data('offset'); | |
var limit = $(this).data('limit'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def extgcd(a, b) | |
if b.zero? | |
{x: 1, y: 0, gcd: a} | |
else | |
prev = extgcd(b, a % b) | |
{ x: prev[:y], | |
y: prev[:x] - (a / b) * prev[:y], | |
gcd: prev[:gcd] } | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def gcd(a, b) | |
return a if b.zero? | |
gcd(b, a % b) | |
end | |
puts gcd(1071, 1029) # => 21 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MAX_V = 10 | |
INF = 100_000_000 | |
$d = Array.new(MAX_V, INF) # 頂点sからの最短距離 | |
$used = Array.new(MAX_V, false) # すでに使われたかのフラグ | |
$V = 7 | |
# | i\j | 0 | 1 | 2 | 3 | 4 | 5 | 6 | | |
# |-----|---|---|---|---|---|---|---| | |
# | 0 | 0 | 2 | 5 |INF|INF|INF|INF| | |
# | 1 | 2 | 0 | 4 | 6 |10 |INF|INF| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Edge | |
# 頂点fromから頂点toへのコストcostの辺 | |
attr_accessor :from, :to, :cost | |
def initialize(from, to, cost) | |
@from, @to, @cost = from, to, cost | |
end | |
end | |
MAX_V = 10 | |
$INF = 100_000_000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Union-Find木 | |
MAX_N = 100 | |
$parent = Array.new(MAX_N) | |
$rank = Array.new(MAX_N, 0) | |
def init(n) | |
n.times do |i| | |
$parent[i] = i | |
end | |
end |
NewerOlder