Skip to content

Instantly share code, notes, and snippets.

View teru01's full-sized avatar

Teruya Ono teru01

  • Ubie, Inc.
  • Tokyo, JP
View GitHub Profile
@teru01
teru01 / gist:ea921928a550afba620353e1e6d2f08a
Created May 12, 2023 04:03
tflintの結果を使ってunused data resourceを削除するスクリプト
// tflint --recursive --config $(pwd)/.tflint.hcl -f json で出力した結果を使う
package main
import (
"bufio"
"encoding/json"
"log"
"os"
"path/filepath"
use std::io;
use std::io::Read;
use std::fs::File;
use std::error::Error;
fn main() -> Result<(), Box<dyn Error>> {
read_username_from_file()?;
Ok(())
}
fn read_username_from_file() -> Result<String, io::Error> {
let mut s = String::new();
user www-data;
worker_processes auto;
error_log error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 4096; ## Default: 1024
}
#!/bin/bash
cd "${0%/*}"
curl -s http://localhost:<port>/debug/pprof/profile?seconds=60 > $1/cpu.pprof
go tool pprof -png $1/cpu.pprof > $1/cpu.png
#!/bin/bash
set -ux
cd "${0%/*}"
dir="${1%/}"
cp kataribe.toml $dir
cat $dir/access.log | kataribe > $dir/result.txt
sudo cp -a /var/log/mysql/mysql-error.log $dir
@teru01
teru01 / setup.sh
Last active September 10, 2020 04:10
setup script
#!/bin/bash
set -ux
cd "${0%/*}"
dir=$(date +%Y-%m-%d-%H-%M-%S)
mkdir $dir
touch $dir/$dir
cp -a nginx.conf $dir
@teru01
teru01 / kubectx_install.sh
Created June 2, 2020 01:50
kubectx installation script for fish shell.
sudo git clone https://github.com/ahmetb/kubectx /opt/kubectx
sudo ln -s /opt/kubectx/kubectx /usr/local/bin/kubectx
sudo ln -s /opt/kubectx/kubens /usr/local/bin/kubens
mkdir -p ~/.config/fish/completions
ln -s /opt/kubectx/completion/kubectx.fish ~/.config/fish/completions/
ln -s /opt/kubectx/completion/kubens.fish ~/.config/fish/completions/
git_branch(){
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
export PS1="\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$(git_branch)\$ "
@teru01
teru01 / rust.md
Last active April 27, 2019 09:27
Rustメモ

これなら問題ない

fn refe(addr: &String) {
    // addr.push('!');
    println!("{}", addr);    
}

fn main() {
 let mut v = "aa".to_string();
<?php
$url = "https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
$file = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);