Skip to content

Instantly share code, notes, and snippets.

View u110's full-sized avatar
💭
👍

Yuu Ito u110

💭
👍
View GitHub Profile
@u110
u110 / mylibrary.r
Created July 12, 2012 02:27
大きさの違う行列の結合関数+よく使う処理メモ
add_zero_mtx<-function(df1,num,side=1){
if(side==1){
return(t(cbind(t(df1),data.frame(matrix(0,ncol=num)))))
}else{
return(t(cbind(data.frame(matrix(0,ncol=num)),t(df1))))
}
}
my_cbind<-function(df1,df2){
num<-abs(nrow(df1)-nrow(df2))
@u110
u110 / d3js_test.html
Created April 10, 2013 13:20
Introduction of d3.js http://d3js.org/
<html>
<head>
<script src="http://d3js.org/d3.v3.min.js"></script>
</head>
<body>
<p>this is a test01.</p>
<p>this is a test02.</p>
<p>this is a test03.</p>
<script>
// var paragraphs = document.getElementsByTagName("p");
@u110
u110 / .tmux.conf
Last active October 16, 2016 07:18
# prefix
unbind C-b
set -g prefix C-t
# hjklでpaneを移動
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
import requests
OAUTH_ACCESS_TOKEN = "xoxp-21*****"
def fetch_image(url):
headers = {
"Authorization": "Bearer %s" % OAUTH_ACCESS_TOKEN
}
from airflow.operators.slack_operator import SlackAPIPostOperator
SLACK_TOKEN = "xoxb-XXXX-YYYY-ZZZ"
# refs.
# https://api.slack.com/docs/message-attachments#action_fields
if __name__ == "__main__":
op = SlackAPIPostOperator(
class Item {
String name;
Item(String name) {
this.name = name;
}
@override
toString() {
return "Item<$name>";
}
}
@u110
u110 / lock-with-channel-buffer.go
Last active January 7, 2020 14:23
同じジョブは同時実行させないようにしたい。 --> channel bufferでblock
package main
import (
"log"
// "runtime"
"sync"
"time"
)
func worker(jobs ...string) <-chan string {
@u110
u110 / timeUntil.go
Created January 8, 2020 13:50
[go] time.Until
package main
import (
"log"
"time"
)
func main() {
log.Println("start.")
defer log.Println("end.")
package main
import (
"fmt"
"math/rand"
"time"
)
func Swap(arr *[]int, i int, j int) {
(*arr)[i], (*arr)[j] = (*arr)[j], (*arr)[i]