Skip to content

Instantly share code, notes, and snippets.

View bluenex's full-sized avatar
🧐
Be explicit with the least redundant.

Tulakan Ruangrong bluenex

🧐
Be explicit with the least redundant.
View GitHub Profile
@bluenex
bluenex / android-dev-osx.md
Last active February 18, 2024 02:01
Setting up Android dev environment without Android Studio via brew on Mac OSX [Android Virtual Device (AVD) included]

Prerequisites

  • Homebrew

Android SDK

Install JAVA

First, install JAVA. Note that Android SDK is not yet supported JAVA 10, so install JAVA 8:

@bluenex
bluenex / how-to-run.md
Last active October 11, 2023 09:04
Guide to run script on terminal in the background with log.

Running in the background

This command can be applied to anything run on cli, for example bash script and python script.

Two ways to do

There are two ways to run process in the background, nohup and & (ampersand).

Steps

@bluenex
bluenex / findClosestTimestampPair.ts
Last active September 27, 2023 06:51
A collection of snippets
interface ObjectWithTimestamp {
timestamp: number;
}
function findClosestTimestampPair(
arr1: ObjectWithTimestamp[],
arr2: ObjectWithTimestamp[]
): [ObjectWithTimestamp, ObjectWithTimestamp][] | [] {
arr1.sort((a, b) => a.timestamp - b.timestamp);
arr2.sort((a, b) => a.timestamp - b.timestamp);
@bluenex
bluenex / libpng_fix.md
Last active August 9, 2023 14:50
fixing 'libpng warning: iCCP: known incorrect sRGB profile' appears in Pygame.

Libpng warning: iCCP: known incorrect sRGB profile.

Some .png images used in pygame may get the warning read as "libpng warning: iCCP: known incorrect sRGB profile". To solve this I have searched and found the solution by using ImageMagick. After installing, single file can be fixed by calling convert <in_img> -strip <out_img>, but to make it fixes every wanted images in path we'll need to modify just a little bit.

Create .bat file contains the following code and place this .bat in the folder that want to be fixed and run to finish it out.

@echo off
ping -n 2 127.0.0.1 > nul

echo this batch will convert ".png" using -strip option from ImageMagick.
@bluenex
bluenex / zsh_envi.md
Last active May 17, 2023 19:31
Moving to Zsh note and configuration settings.

Moving to Zsh

Have a good time with bash for a long while, it's time to try another tempting shell - Zsh. So, this Gist is nothing but my collection for the environment that I've searched and applied to my system. There is also this kind of Gist in a version of bash.

Why Zsh?

There are several shells out there but this is the one that is close to the bash with some useful and attractive features especially - yes, theme. Here are some good articles about how and why to choose Zsh over bash, enjoy trying!

@bluenex
bluenex / vim_note.md
Created September 27, 2015 17:33
Vim with spf13 cheat sheet

VIM NOTE

Vim with spf13 cheat sheet

Keys description
i insert before the cursor
I insert at start of line
a insert after the cursor
A insert at start of line
o insert line below
@bluenex
bluenex / climbStairs.js
Last active August 19, 2022 05:54
Visualize the possibility of https://leetcode.com/problems/climbing-stairs. Can be run up to around n=18 before memory allocation error occurs.
// 1 -> 1
// 2 -> 11 2
// 3 -> 111 12 21
// 4 -> 1111 112 121 211 22
// 5 -> 11111 1112 1121 1211 122 2111 212 221
// 6 -> 111111 11112 11121 11211 12111 1122 1212 1221 21111 2112 2121 2211 222
const getAllScenarios = (current, collection) => {
if (!collection.has(current)) {
collection.set(current, "");
@bluenex
bluenex / cobalt2.itermcolors
Last active April 27, 2022 15:02
iTerm2 color theme collection
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Blue Component</key>
<real>0.0</real>
<key>Green Component</key>
<real>0.0</real>
@bluenex
bluenex / git_command_note.md
Last active April 28, 2021 00:16
Git command note

The latest commit

git commit --amend

The command amend changes the latest commit by replacing with the new one. Suppose you have changes in working directory, by running git commit --amend the new changes will be committed as replacement of the old latest commit. If there is no new changes, this command will let you change commit comment of the latest commit and save as new commit replacing old latest commit.

# undo commit
git reset --soft HEAD~1
# undo add
@bluenex
bluenex / alacritty.yml
Created February 16, 2021 06:08
My alacritty config file placing at `~/.config/alacritty/alacritty.yml`.
# Configuration for Alacritty, the GPU enhanced terminal emulator.
# Import additional configuration files
#
# Imports are loaded in order, skipping all missing files, with the importing
# file being loaded last. If a field is already present in a previous import, it
# will be replaced.
#
# All imports must either be absolute paths starting with `/`, or paths relative
# to the user's home directory starting with `~/`.