Skip to content

Instantly share code, notes, and snippets.

View wittawasw's full-sized avatar

Wittawas W wittawasw

View GitHub Profile
# Fix permission denied while trying to connect to the Docker daemon socket
# at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.47/containers/json":
# dial unix /var/run/docker.sock: connect: permission denied
# source: https://github.com/rancher-sandbox/rancher-desktop/issues/1156#issuecomment-1017042882
sudo addgroup --system docker
sudo adduser $USER docker
newgrp docker
# And something needs to be done so $USER always runs in group `docker` on the `Ubuntu` WSL
sudo chown root:docker /var/run/docker.sock
// Generate with these commands
//
// rails new <app_name> && cd <app_name>
// rails g scaffold courses name:string description:text summary:string{500}
// rails g scaffold student name:string email:text
// ruby <relative_path>/generate_tests.rb
{
"id": "test-rails-example-app-1723988622",
"tasks": [
@wittawasw
wittawasw / deer.cow
Created August 2, 2024 23:53 — forked from LunaticNeko/deer.cow
Deer for Cowsay
$the_cow = <<"EOC";
$thoughts\\_\\_ _/_/
$thoughts \\__/
$thoughts ($eyes)\\_______
-- \\ )\\/\\
$tongue ||-----||
|| ||
EOC
function ks() {
kgpo | awk 'NR>1 {print $1}' | grep "$1" | while read -r POD_NAME; do
echo "$POD_NAME"
done
}
function krrm() {
kgpo | awk 'NR>1 {print $1}' | grep "$1" | while read -r POD_NAME; do
krm pod "$POD_NAME"
# merge branch into main, develop then tag and push all.
ghf () {
# hotfix/{VERSION}
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
git checkout develop
git merge $BRANCH_NAME
git checkout main
#!/bin/bash
# Go into every directory 1 level inside current directory
for dir in */; do
# Move files with extension .parquet from sub-directory to current directory
find "$dir" -maxdepth 1 -type f -name "*.parquet" -exec mv -t . {} +
done
# Rename those files by removing sub-string -parquet- from their names
for file in *.parquet; do mv "$file" "${file/-parquet-/}"; done
@wittawasw
wittawasw / gitignore.sh
Last active February 14, 2024 07:31
Setup global .gitignore
# todo will be ignored in all git repos
echo "todo" >> ~/.gitignore
git config --global core.excludesfile ~/.gitignore
plugins {
kotlin("jvm") version "1.9.21"
id("application")
}
repositories {
mavenCentral()
}
val kotlinSdkVersion = "1.0.41"
@wittawasw
wittawasw / folder_structure.md
Created January 20, 2024 08:02 — forked from ayoubzulfiqar/folder_structure.md
The Folder Structure for Every Golang Project

Go - The Ultimate Folder Structure

Organizing your Go (Golang) project's folder structure can help improve code readability, maintainability, and scalability. While there is no one-size-fits-all structure, here's a common folder structure for a Go project:

project-root/
    ├── cmd/
    │   ├── your-app-name/
    │   │   ├── main.go         # Application entry point
    │   │   └── ...             # Other application-specific files
@wittawasw
wittawasw / golang_web_dev_course_outline.md
Last active January 10, 2024 15:59
Web Development with Golang - Course Outline

Web Development with Golang

1: Running Go

  • Introduction to Go Environment
  • Compilation and Execution
    • go build
    • go run

2: Go Project Structure

  • Understanding Go Packages