Skip to content

Instantly share code, notes, and snippets.

View kittinunf's full-sized avatar

Kittinun Vantasin kittinunf

View GitHub Profile
REMOTE_NAME=xxxxx
git branch -r | grep "${REMOTE_NAME}/" | grep -v 'master$' | grep -v HEAD | sed -E "s/^[[:space:]]*${REMOTE_NAME}\///g" | while read line; do git push $REMOTE_NAME :heads/$line; done;
#!/usr/bin/env bash
# fail if any commands fails
set -eu
# Requirements
# - Set GITHUB_TOKEN as environment variable.
# - This token must have `repo` permission and authorize kouzoh organization.
if [[ $# -ne 2 ]]; then
echo "Usage: ./script/merge_branch.sh BASE_BRANCH COMPARE_BRANCH"
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
vector<int> sortKMessedArray(const vector<int>& v, int k) {
auto N = v.size();
if (N == 0) return {};
class Solution {
public:
struct Position{
int row;
int col;
int cost;
};
int toIndex(int M, int r, int c) {
open class Holder<out T: Any, in A>(creator: (A) -> T) {
private var creator: ((A) -> T)? = creator
@Volatile private var instance: T? = null
fun instance(arg: A): T {
val ins = instance
if (ins != null) {
return ins
}
@kittinunf
kittinunf / kotlin2_0.kt
Last active July 11, 2024 05:58
Kotlin2.0 and Beyond
package com.github.kittinunf.kotlin2_0
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableSharedFlow
fun example1() {
// 1.
/**
* 1. Better operator and understanding code
*