Skip to content

Instantly share code, notes, and snippets.

View 4sskick's full-sized avatar
🏠
Working from home

tian 4sskick

🏠
Working from home
View GitHub Profile
I did change on one service which defined on docker-compose, so need to rebuild the service specific. When run command `docker-compose build name_service_app`, It failed and got timeout when doing fetch metadata token
```
failed to solve: maven:3.6.3-openjdk-17-slim: failed to authorize: failed to fetch anonymous token: Get "https://auth.docker.io/token?scope=repository%3Alibrary%2Fmaven%3Apull&service=registry.docker.io": read tcp 192.168.0.176:55021->54.198.86.24:443: wsarecv: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
```
when doing run `docker-compose up` got loine log error `2024/02/29 17:44:52 http2: server: error reading preface from client //./pipe/docker_engine: file has already been closed`.
I did restart, solve nothing. So reinstalling I did and nothing solve, got another error like on forum https://forums.docker.com/t/an-unexpected-error-was-encountered-while
@4sskick
4sskick / run debug version app react native in no time
Last active February 23, 2024 10:28
run debug version project application react native into emulator and emulate `shake` to emulator device
I got annoying and really have bad experiences to work project using react native (will called as RN) framework. It sluggies and slow!
Just becaue my company is using RN on all their latest mobile project, I do have to force myself to work with it
I got annoyed when it's time to run the project, if follow the resources which spread on internet, you need to hit command `npm/yarn react-native run android`.
I need to wait for a certain time to build and run on emulator. So I've got another method which cutting time to run the project in no time.
- Generate APK of your project on variant DEBUG on Android Studio
- finish, then open the project RN using vscode (or other editor) then do `yarn start` / whatever command to run the RN server
- drag & drop the APK file to emulator to make it automatically install (seems like it only for android Emulator, I have no idea for iOS simulator)
- on first time will run error, don't worry. READ THE ERROR MESSAGE!!
- run command `adb [opt: -s id-emulator] shell input keyevent 8
@4sskick
4sskick / how run ts on js node folder project
Last active February 23, 2024 10:29
run ts on js node folder project
I have folder project which run a js file, by default it will only run a JS files. I want to make it run the TS file, also able to use console.log as JS file do
- create `package.json` see file below
- create `tsconfig.json` see file below
- do npm install, and they will do the rest
- done, then run ts file with `npm start ts_file.ts`
I'm using version 3.12 on virtual env with wsl2
- make sure to activate the virutal env `source venv/bin/activate`
- I'm using flask as framework `pip install flask==3.0.0` then continue with `pip install pytest==7.4.2`
- make skeleton project like this:
├── project
│ ├── __init__.py
│ ├── app.py
└── tests
├── __init__.py
└── app_test.py
@4sskick
4sskick / python3.10 to python3.12 on env
Last active November 29, 2023 05:03
python 3.10 on system but wanna using python 3.12 on venv
- I use WSL 2 on windows machine, by default it using version 3.10. Then I install the version 3.12 by add repo `sudo add-apt-repository ppa:deadsnakes/ppa`
- do `sudo apt update`. Let's see, if the version 3.12 are listed and availbale to install by `apt list | grep python3.12`. It will list all the python version 3.12
- do install `sudo apt install python3.12` finish then check version `python3.12 --version`
- install add on essential `sudo apt install python3.12-venv python3.12-dev`
- when everthing are done, ready to create venv `python3.12 -m venv venv`
- do activate the virtual env `source venv/bin/activate`
- check python version usin on venv `python --version`
- do deactivate the virutal env just type `deactivate` on root project
@4sskick
4sskick / RUST - initial setup
Last active July 6, 2023 04:04
RUST setup initial project from installation until run on first time
there's already a bunch of tutorial setup on internet up there. I will just covering some in my version from creating new project till run on as debug. I am using wsl2 on win11.
Following the steps on book Zero to production in RUST: An opinionated Introduction Backend. First thing first you need to install `rustup`, can be found on https://rustup.rs/
- open terminal and run wsl, run `sudo apt install build-essential # Install pre-reqs`
- done, then `curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh`
- it will downloading rust installer, proceed with type 1 to continue. Wait till finish
- verify the instalation by type `source $HOME/.cargo/env` and `rustc --version`. Output will there like rustc `1.70.0 (90c541806 2023-05-31)`
- if hapen not found for `rustc --version`, try to reload the wsl by shutdown command and re-open it up
- create folder for development like `mkdir rust_project` or whatever you like.
- type `cargo new rust_test` and open vscode by `code .`
- hit buton f5 and see recommenda
@4sskick
4sskick / React Native Debug
Last active June 30, 2023 06:46
React Native - Debugging Tools
DEBUG-ger react native
---------------------------
use standalone https://github.com/jhen0409/react-native-debugger (rnDebugger)
Mine is use a windows version from release page
- run applicaiton of react native as usual
- open downloaded file of rnDebugger
- open menu developer by type d on terminal or by shaking device
- tap on Debug
- rnDebugger automatically will detect open port for debug
- for first time might be there's error, mine is relate with `invariant-violation-calling-synchronous` bla bla bla~
@4sskick
4sskick / nestjs CLI - new project
Created March 18, 2023 12:44
Nestjs CLI installation generate new project
first time use NestJS and following the documentation. Doc is your friend tbh!
type 'npm i -g @nestjs/cli', done and I got error with some warning.
it said that my npm & angular-devtool version doesn't support and compatible. I don't knwo the detail.
Then I check for latest version lts Node and install it.
I use 'nvm install --lts' wait for done & check using 'nvm ls' it will show you the version of Node version you are using, mine is v18.15.0
re-type 'npm i -g @nestjs/cli' and got no error.
Time to generate new project, type 'nest new <project_name>' and would be asked to which package manager you wanna use, I choose NPM.
Wait till done and finish
I faced a problem when doing some development on Code Igniter project. I have to setup .htaccess to remove index.php from URL. Also face a weird problem when I catch the POST value from form view I created. They aren't delive value of POST data
short lonk story, after I evaluating the whole project's config of framework. Turns out that the culprit is the .htaccess file.
So I need to check the module is already enabled or not on apache. Here the repo project I mean https://github.com/4sskick/infra
Disclaimer:
===========
this only a temporer solution, I believe when I remove the base image of container project, the setup would be back to default.
So you have to re-enable the steps I write here. DYOR !
- make sure you already run the container by docker-compose up -d
@4sskick
4sskick / SQLite migration room db - android
Created March 22, 2022 08:54
short tips on doing migration mobile development using room DB
this process (mgration) is a vital step need to defined very serious.
after setup library room db on android you need to make sure to export schema everytime it changes.
see mine here:
---
build.gradle (app)
---
defaultConfig {
//schema provide for DB room
javaCompileOptions {
annotationProcessorOptions {