Skip to content

Instantly share code, notes, and snippets.

View int128's full-sized avatar

Hidetake Iwata int128

View GitHub Profile
@int128
int128 / gist:181c075ce966022ae1d129e450dd3051
Last active October 14, 2017 08:22
Example of Doc2Vec and Google Cloud Natural Language API
from gensim.models.doc2vec import Doc2Vec
from gensim.models.doc2vec import TaggedDocument
from google.cloud import language
def wakachigaki(text):
client = language.Client()
document = client.document_from_text(text)
annotations = document.annotate_text()
words = []
@int128
int128 / README.md
Last active May 6, 2025 12:59
Watching build mode on Create React App

Create React App does not provide watching build mode oficially (#1070).

This script provides watching build mode for an external tool such as Chrome Extensions or Firebase app.

How to Use

Create a React app.

Put the script into scripts/watch.js.

@int128
int128 / nginx.conf
Created December 28, 2016 10:35
Nginx conf for Sonar 6.x behind SSL-termination
# Sonarqube
server {
listen 80;
server_name sonar.example.com;
location / {
proxy_pass http://sonarqube:9000;
proxy_redirect http://sonarqube:9000 https://sonar.example.com;
}
}
@int128
int128 / README.md
Created December 6, 2016 11:02
How to handle GitHub Webook on Tag pushed on Jenkins
  • Refspec: +refs/tags/*:refs/remotes/origin/tags/*
  • Branch Specifier: */tags/*
@int128
int128 / gist:14255ff1b1ed11ce1f661a7d35954c2b
Created October 26, 2016 10:18
How to execute a remote command on the Jenkins Script Console
import hudson.util.RemotingDiagnostics;
def node = 'node-name'
def command = 'uname -a'
println RemotingDiagnostics.executeGroovy("""
def p = '$command'.execute()
p.waitFor()
println p.in.text
@int128
int128 / nginx.conf
Last active October 7, 2016 10:50
Nginx redirect config for collaborate GitBucket and Jenkins with GitHub plugin
server {
listen 80;
server_name git.example.org;
location ~ ^/[^/]+/[^/]+\.git.*$ {
return https://git.example.org/git$request_uri;
}
location ~ ^/api/v3/users/(.*)$ {
try_files $uri /api/v3/orgs/$1;
}
location / {
@int128
int128 / httpd.conf
Created August 29, 2016 05:20
Default httpd.conf of docker image httpd:2
ServerRoot "/usr/local/apache2"
LoadModule access_compat_module modules/mod_access_compat.so
LoadModule reqtimeout_module modules/mod_reqtimeout.so
LoadModule filter_module modules/mod_filter.so
LoadModule mime_module modules/mod_mime.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule env_module modules/mod_env.so
LoadModule headers_module modules/mod_headers.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
@int128
int128 / README.md
Created August 25, 2016 07:55
Use Cygwin Git from command prompt

Use Cygwin Git from command prompt and other apps.

  1. Put git.cmd into the Cygwin root e.g. C:\cygwin64.
  2. Add the Cygwin root to the PATH environment variable.
@int128
int128 / init.sh
Last active August 4, 2016 08:05
Bootstrap with Docker and Docker Compose
sudo yum update -y
sudo yum install -y docker
sudo curl -L -o /usr/local/bin/docker-compose https://github.com/docker/compose/releases/download/1.8.0/docker-compose-`uname -s`-`uname -m`
sudo chmod +x /usr/local/bin/docker-compose
sudo usermod -a -G docker ec2-user
docker -v
docker-compose -v

Instructions to reproduce bug int128/gradle-ssh-plugin#253

2016-07-29 15:16:25.283 WARN  Host key checking is off. It may be vulnerable to man-in-the-middle attacks.
2016-07-29 15:16:26.584 INFO  Connected to sandbox [sandbox:22]
2016-07-29 15:16:27.119 INFO  Started command sandbox#0: mkdir -vp /tmp/hoge/foo/bar
2016-07-29 15:16:27.360 INFO  Success command sandbox#0: mkdir -vp /tmp/hoge/foo/bar
2016-07-29 15:16:27.587 ERROR Error: groovy.lang.MissingMethodException: No signature of method: org.hidetake.groovy.ssh.session.transfe
r.SftpRemove$Trait$Helper$_remove_closure1$_closure2$_closure4.call() is applicable for argument types: (org.codehaus.groovy.runtime.GSt
ringImpl) values: [/tmp/hoge/foo/bar]