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
@4sskick
4sskick / Error: listen EADDRINUSE: address already in use
Created September 26, 2024 03:54
Error: listen EADDRINUSE: address already in use
so this issue will clearly tell you that the address or port is in use by another program or task service process. The error will tell you oike this,
```bash
Error: listen EADDRINUSE: address already in use 127.0.0.1:9323
at Server.setupListenHandle [as _listen2] (node:net:1372:16)
at listenInCluster (node:net:1420:12)
at GetAddrInfoReqWrap.doListen (node:net:1559:7)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:73:8) {
code: 'EADDRINUSE',
errno: -4091,
syscall: 'listen',
@4sskick
4sskick / macOS Error: Operation not permitted
Last active September 23, 2024 04:21
macOS Error: /bin/bash: bad interpreter: Operation not permitted
so when doing development on react native platform (iOS), I do build then failed with error operation not permitted on file react-native-xcode.sh (under react-native/scripts folder). Confuse and have no idea how to solve, because I am new using xCode IDE.
Looking for resolution issue but hesitant because am not really familiar with mac OS system. After some reading on resolution I am confident to execute some command for resolve the issue.
So the file is on quarantine attribute because I ever see content of file using 'cat' which leading to edit the script using textEdit *excuse my knowledge on this*
so to resolve the issue you need to make sure is the file (react-native-xcode.sh) is appear on list then execute command `xattr -l react-native-xcode.sh`
if so, then you need to remove react-native-xcode.sh under xattr command using `xattr -d react-native-xcode.sh`
make sure again using `xattr -l react-native-xcode.sh` then build
ref:
- https://web.archive.org/web/20240225084013/https://www.codingcatlady.net/20
@4sskick
4sskick / React Native index.android.bundle
Last active September 11, 2024 09:50
index.android.bundle need to generate everytime generate application file variant release
so, in react native specific platform Android, they gonna read bundled file which generated by minified of index.js to make it smoother when aplication run. If somehow the `index.android.bundle` file not found, you can generate by your self.
run command `npx react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle`
it will generate fil `index.android.bundle` under folder `android/app/src/main/assets`
after finish, can run using release version apk file or using command
`npx react-native run-android --variant=release`
ref:
@4sskick
4sskick / SQL import large file
Last active July 9, 2024 07:21
import large file SQL
I have SQL file with size 16GB, but can't import directly using SQL server management tools.
So sqlcmd is the saviour!!
simply just run the command with following format
```
sqlcmd -S ‘your server name’ -U ‘user name of server’ -P ‘password of server’ -d ‘db name’-i ‘script.sql’ -a 32767
```
in may case would be
```
@4sskick
4sskick / OkHttp 3 implementation of Volley's HttpStack - OkHttpStack.java
Last active June 19, 2024 22:28 — forked from NightlyNexus/OkHttpStack.java
OkHttp 3 implementation of Volley's HttpStack
/*
* Copyright (C) 2016 Eric Cochran
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@4sskick
4sskick / React Native From Scratch!
Last active July 24, 2024 06:18
React Native Project from Scratch!
- make sure to use nvm, you can read from here (https://www.freecodecamp.org/news/node-version-manager-nvm-install-guide/)
- by the time I write this (30.04.24), react native latest version 0.74
- If you read the documentation guide (https://reactnative.dev/docs/environment-setup?guide=native), need to use minimum version node 18
- I use version node 20, by install using `nvm install 20.12.2`
- then use the downloaded version node, `nvm use 20.12.2`
- don't forget to install yarn, if you're using it `npm install --global yarn`
- all set!!
- ready to setup and start typing `npx react-native@latest init projectName`
- or if you wanna specify the version react native to use add `--version 0.73`
- `npx react-native@latest init projectName --version 0.73`
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