Skip to content

Instantly share code, notes, and snippets.

View carthegian's full-sized avatar

Jerfareza Daviano carthegian

View GitHub Profile
@carthegian
carthegian / version-release.yml
Created December 6, 2021 14:06
Github action workflow to manage versioning upon pull request to a branch
# This is a workflow to update version of of an application
name: Version-release
on:
# Run this workflow only if PR to master branch is closed
pull_request:
types: [closed]
branches:
- master
# Also enable manual trigger workflow run
@carthegian
carthegian / nginx.conf
Created November 12, 2021 02:34
Nginx in Mac OS
#user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid /run/nginx.pid;
@carthegian
carthegian / callAPIviaCURL.gs
Created April 9, 2021 01:31
Google Apps Script example to call API via CURL
/**
* 関数を実行するメニューを追加
*/
function onOpen() {
var menuExecution =[
{name: "json整形", functionName: "indentJson"},
{name: "当シートAPIをcurlで実行", functionName: "automateCurrentAPICall"},
{name: "全てAPIをcurlで実行", functionName: "automateAllAPICalls"},
];
@carthegian
carthegian / main.go
Created March 26, 2021 07:19
A simple example of benchmarking with Go
package main
import (
"bytes"
"math/rand"
"strings"
)
func main() {
// This main function does nothing since we only want to test benchmarking
@carthegian
carthegian / main.go
Last active September 10, 2023 23:16
How to write large amount of data to CSV sequentially or concurrently
package main
import (
"encoding/csv"
"fmt"
"log"
"math/rand"
"os"
"strconv"
"sync"
@carthegian
carthegian / Vagrantfile
Created February 10, 2021 02:55
Base VagrantFile to use ssh with custom username & custom public key
Vagrant.configure("2") do |config|
# Define vm box
config.vm.box = "gbailey/amzn2"
# Constraint vm box version
config.vm.box_version = "20210127.0.0"
# Copy public key from host to guest
# Prerequisite: need to have id_rsa.pub in host machine
# Use ssh-keygen to create keys in path e.g. Windows C:\Users\<USER_NAME>\.ssh\id_rsa/pub
config.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "~/.ssh/id_rsa.pub"
@carthegian
carthegian / Vagrantfile
Last active December 9, 2020 06:57
A quick gist for building gRPC client-server using Go
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
BOX_IMAGE = "gbailey/amzn2"
@carthegian
carthegian / exampleGas.js
Last active December 8, 2020 04:24
Google Apps Script example to jump to specific sheet and cell based on some conditions upon opening a Google Sheets document.
function onOpen(e) {
// Get current month
var now = new Date();
var currentMonthSheet = now.getFullYear() + "年" + (now.getMonth() + 1) + "月";
// Jump to current month's sheet
var sheetToSet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(currentMonthSheet);
SpreadsheetApp.setActiveSheet(sheetToSet);
// Jump to current date's cell by iterating dates in column range
@carthegian
carthegian / Vagrantfile
Last active March 10, 2022 21:02
A quick gist for JMeter stress testing using Vagrant with Amazon Linux 2 (X11 forwarding enabled for JMeter GUI in host machine)
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
BOX_IMAGE = "gbailey/amzn2"
@carthegian
carthegian / Vagrantfile
Last active January 13, 2023 20:17
A quick gist for Vagrant with Amazon Linux 2 + PHP 7.4. Specifically for kickstart communicating with Google APIs using gRPC.
# -*- mode: ruby -*-
# vi: set ft=ruby :
@script = <<SCRIPT
# Install php and extensions
# PHPと拡張をインストールする
sudo amazon-linux-extras install php7.4
sudo ln -s /usr/bin/php /usr/local/bin/php