Skip to content

Instantly share code, notes, and snippets.

View ikhsanalatsary's full-sized avatar
🏠
Working from home

Abdul Fattah Ikhsan ikhsanalatsary

🏠
Working from home
View GitHub Profile
@ikhsanalatsary
ikhsanalatsary / setup_cmder_wsl.md
Last active January 17, 2024 16:31
Setup cmder with WSL 2

Using WSL 2

  1. Open cmder
  2. On the menu, open Settings option and then select Startup > Tasks from the menu tree (or just hit Win + Alt + T)
  3. Click the “+” button to add a new task and fill in the fields as follow:
  4. Name: {zsh::home}
  5. Task Parameters:
    /icon "%CMDER_ROOT%\icons\cmder.ico"
    
@ikhsanalatsary
ikhsanalatsary / log.js
Created January 27, 2021 01:32 — forked from vikas5914/log.js
Custom Logger Library with winston
const { createLogger, format, transports } = require('winston')
const moment = require('moment')
// set default log level.
const logLevel = 'info'
var logger = createLogger({
level: logLevel,
levels: {
fatal: 0,
@ikhsanalatsary
ikhsanalatsary / git-log-json.sh
Created November 25, 2022 18:12 — forked from april/git-log-json.sh
pure shell function for git log as JSON
# attempting to be the most robust solution for outputting git log as JSON,
# using only `git` and the standard shell functions, without requiring
# additional software.
# - uses traditional JSON camelCase
# - includes every major field that git log can output, including the body
# - proper sections for author, committer, and signature
# - multiple date formats (one for reading, ISO for parsing)
# - should properly handle (most? all?) body values, even those that contain
# quotation marks and escaped characters
@ikhsanalatsary
ikhsanalatsary / README.md
Created November 6, 2022 03:38 — forked from palewire/README.md
How to push tagged Docker releases to Google Artifact Registry with a GitHub Action

How to push tagged Docker releases to Google Artifact Registry with a GitHub Action

Here's how I configured a GitHub Action so that a new version issued by GitHub's release interface will build a Dockerfile, tag it with the version number and upload it to Google Artifact Registry.

Before you attempt the steps below, you need the following:

  • A GitHub repository that contains a working Dockerfile
  • The Google Cloud SDK tool gcloud installed and authenticated

Create a Workload Identity Federation

@ikhsanalatsary
ikhsanalatsary / copy_git_branch.sh
Created August 1, 2022 00:54
Copy your current working git branch to clipboard
#!/bin/bash
git branch|grep '* '|pbcopy
@ikhsanalatsary
ikhsanalatsary / measure.js
Last active March 21, 2022 00:20
lodash.merge vs object.assign vs object spread syntax in node js
let _ = require('lodash')
let { performance, PerformanceObserver } = require("perf_hooks")
let perfObserver = new PerformanceObserver((list, observer) => {
let durations = [];
let results = [];
list.getEntries().forEach((entry) => {
console.log(entry)
durations.push(entry.duration)
results.push({name: entry.name, duration: entry.duration})
@ikhsanalatsary
ikhsanalatsary / wp-register-user.php
Last active July 21, 2021 05:04
Custom Plugin to Handle Register User Endpoint for Wordpress
<?php
/**
* @package WP_Register_User
* @version 1.0.0
*/
/*
Plugin Name: WP Register User
Plugin URI: https://github.com/ikhsanalatsary/
Description: Register user custom endpoint
Author: Abdul Fattah Ikhsan
@ikhsanalatsary
ikhsanalatsary / add_python_to_WINDOWS_WSL_ubuntu.md
Last active June 6, 2021 13:23 — forked from monkut/add_python_to_WINDOWS_WSL_ubuntu.md
Add python to Windows Subsystem for Linux (WSL) [ubuntu]
@ikhsanalatsary
ikhsanalatsary / types.ts
Last active April 14, 2021 09:45
Mengeluarkan tipe null dan undefined dari tipe data pada TypeScript
export type Maybe<T> = T | null | undefined;
type UnpackArray<T> = T extends (infer U)[] ? U : T;
type Unpack<T, U> = U extends keyof T ? T[U] : never;
// type Post = { id: string; title: string; content: Maybe<string> };
type Post = {
__typename?: 'Post';
authorDatabaseId: Maybe<number>;
authorId: Maybe<string>;
bodyClasses: Maybe<string>;
@ikhsanalatsary
ikhsanalatsary / push_to_github.rb
Created March 23, 2021 05:24 — forked from harlantwood/push_to_github.rb
Commit and push via Github REST API, from ruby RestClient
# Committing changes to a repo via the Github API is not entirely trivial.
# The five-step process is outlined here:
# http://developer.github.com/v3/git/
#
# Matt Swanson wrote a blog post translating the above steps into actual API calls:
# http://swanson.github.com/blog/2011/07/23/digging-around-the-github-api-take-2.html
#
# I was not able to find sample code for actually doing this in Ruby,
# either via the HTTP API or any of the gems that wrap the API.
# So in the hopes it will help others, here is a simple function to