Skip to content

Instantly share code, notes, and snippets.

View tacahiroy's full-sized avatar
🐑

Takahiro YOSHIHARA tacahiroy

🐑
  • Karabiner Software
  • Tokyo, JAPAN
  • 20:59 (UTC +09:00)
  • X @tacahiroy
View GitHub Profile
@tacahiroy
tacahiroy / main.yml
Created October 23, 2019 06:51
Escaping curly braces in an Ansible task
# Since a pair of curly braces is used to define placeholder in an Ansible task, if the command contains curly braces it will become syntax failure.
# To pass curly braces to the `command` properly `{% raw %}` can be used, but `\{\{` doesn't work.
- name: Get path for the Docker volume
command: docker volume inspect -f {% raw %} '{{ .Mountpoint }}' {% endraw %} docker-volume-name
register: mp
@tacahiroy
tacahiroy / iptables.rules
Created October 17, 2019 10:17
DROP outgoing connection using iptables
*filter
-A OUTPUT -d 1.1.1.1/32 -p tcp --dport 443 -j REJECT
@tacahiroy
tacahiroy / mtt.go
Created September 11, 2019 03:58
Converts colour settings from minttyrc to Windows Terminal
package main
// This programme generates Windows Terminal colorScheme definition from minttyrc.
import (
"bufio"
"errors"
"fmt"
"io"
"os"
@tacahiroy
tacahiroy / split.sh
Created August 26, 2019 06:39
Split large files
split -b 1G some-large-file.img "/path/to/some-large-file.img.parta"
@tacahiroy
tacahiroy / git_polling.jenkins
Created August 6, 2019 06:00
Setup Git polling with Jenkins declarative pipeline
pipeline {
agent {
node {
label any
}
}
triggers {
pollSCM 'H 20 * * 1-5'
}
@tacahiroy
tacahiroy / get_host_info_ansible.sh
Created June 4, 2019 01:39
Get information for a host by Ansible
ansible my.server -m setup
@tacahiroy
tacahiroy / ansible.sh
Created May 8, 2019 06:07
Ansible plays w/o Python2 on Fedora 30
ansible-playbook -i hosts -k -e 'ansible_python_interpreter=/usr/bin/python3' playbook.yml
@tacahiroy
tacahiroy / pkgfile
Created April 8, 2019 14:37
Find a package which contains a target file
pkgfile -s msys-crypto-1.1.dll
@tacahiroy
tacahiroy / prometheus.yml
Created March 1, 2019 05:25
Filter instances by EC2 tag Name in Prometheus config
scrape_configs:
- job_name: 'ec2'
ec2_sd_configs:
- region: '{{ prometheus_aws_region }}'
access_key: '{{ prometheus_aws_access_key }}'
secret_key: '{{ prometheus_aws_secret_access_key }}'
port: 9100
refresh_interval: 1h
filters:
- name: 'tag:Name'
@tacahiroy
tacahiroy / gor.go
Created February 22, 2019 00:52
A goroutine example
ch := make(chan byte, 1)
for p := range projs {
go func() {
r := getData(p)
fmt.Println(r)
ch <- 1
}
<-ch
}()