Skip to content

Instantly share code, notes, and snippets.

package main
import (
"fmt"
)
func main() {
arr := []int{10, 7, 3, 4, 6, 7, 0, 9}
arr = sort(arr)
package main
import (
"fmt"
"sync"
"time"
)
func main() {
fmt.Println(time.Now())
@yasuoza
yasuoza / Dockerfile.linux64
Last active January 2, 2019 06:04
Dockerfile for AdGuardHome
# https://github.com/AdguardTeam/AdGuardHome/blob/fd629be/Dockerfile.linux64
FROM alpine:latest
# AdGuard version
ARG ADGUARD_VERSION="0.92"
ENV ADGUARD_VERSION $ADGUARD_VERSION
# AdGuard architecture and package info
ARG ADGUARD_ARCH="linux_amd64"
ENV ADGUARD_ARCH ${ADGUARD_ARCH}
@yasuoza
yasuoza / LocalProfileInstallServer.swift
Created March 27, 2015 05:21
Install configuration profile through iOS application with CocoaHTTPServer
/*
* Be sure not to close local server at `applicationDidEnterBackground:`.
* This causes file not found error in Safari.
*/
class LocalHTTPConnection: HTTPConnection {
override func httpResponseForMethod(method: String!, URI path: String!) -> NSObject! {
if path == LocalWebViewRouter.Profile.URL.path {
return LocalProfileReponse(filePath: self.filePathForURI(path), forConnection: self)
@yasuoza
yasuoza / csv2vcf_docomo.rb
Last active August 29, 2015 14:06
Convert exported csv to vcf card
require 'csv'
input = ARGV[0] || 'exported_contacts.CSV'
output = "#{Time.now.strftime('%Y%m%d-%H%M%S')}.vcf"
groups = {
'グループなし' => 0,
}
File.open(output, 'w:cp932') do |file|
@yasuoza
yasuoza / add_file.rb
Last active August 29, 2015 14:01
add file to xcode project
# FYI:
# http://www.j7lg.com/archives/1732
require 'xcodeproj'
def bail_if_nil(obj, msg)
return unless obj.nil?
puts msg
exit
end
minitest ~> 4.7.3
$ ci-test $(find -L $PWD/test -name \*_test.rb)
Starting test-queue master (/tmp/test_queue_16649_70329599330480.sock)
==> Summary (8 workers in 2.5028s)
[ 8] 0 tests, 0 assertions, 0 failures, 0 errors, 0 skips 0 suites in 0.0055s (pid 16702 exit 0)
[ 1] 6 tests, 16 assertions, 0 failures, 0 errors, 0 skips 2 suites in 1.0579s (pid 16695 exit 0)
require 'active_record'
DATABASE_NUM = ENV['CI_DATABASE_NUM'] || 2
namespace :ci do
task :test_environment => :environment do
ENV['RAILS_ENV'] = Rails.env = ActiveRecord::Tasks::DatabaseTasks.env = 'test'
end
namespace :db do
require 'date-utils'
module.exports = (robot) ->
robot.respond /([^\s]*)\s?の\s?([^\s]*)\s?の運勢/i, (msg) ->
dateArgs = msg.match[1]
signArgs = msg.match[2]
date = switch dateArgs
when '昨日'
Date.yesterday()
require 'net/http'
require 'json'
GITLAB_URL = 'http://source.yourhost.com'
GITLAB_TOKEN = '>>>>'
BITBUCKET_OWNER = '>>>>'
BITBUCKET_PASSWORD = '>>>>'