Skip to content

Instantly share code, notes, and snippets.

View Dadangdut33's full-sized avatar
🦕
Frog

Fauzan F A Dadangdut33

🦕
Frog
View GitHub Profile
@Dadangdut33
Dadangdut33 / Git_Assume_Unchanged
Created March 13, 2022 10:59
Ignore/unignore a file from git locally
# Ignore locally
git update-index --assume-unchanged .\pathtofile
# Unignore locally
git update-index --no-assume-unchanged .\pathtofile
@Dadangdut33
Dadangdut33 / update_node_replit
Last active March 26, 2022 09:58
Use latest node version in replit.
# Method 1
# Source https://replit.com/talk/ask/change-node-version/5924
export NVM_DIR="$HOME/.nvm" &&
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" &&
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" &&
nvm install --lts &&
nvm use --lts
# Method 2
@Dadangdut33
Dadangdut33 / array_to_csv_snippet_vanilla.js
Created July 5, 2022 15:37
Js array to csv the vanilla way
const dataExport = [];
dataExport.push(['multi', 'array', 1, 2, 3])
// the vanilla way
let content = 'data:application/csv;charset=utf-8,';
dataExport.forEach(function (row) {
content += row.join(',') + '\n';
});
const encodedData = encodeURI(content);
@Dadangdut33
Dadangdut33 / toggle_terminal.py
Last active February 21, 2023 17:59
Toggling hide console/terminal including windows terminal in python
import ctypes
import win32.lib.win32con as win32con
import win32gui # pip install pywin32
from time import sleep
kernel32 = ctypes.WinDLL('kernel32')
user32 = ctypes.WinDLL('user32')
a = input('Input value here:')
@Dadangdut33
Dadangdut33 / git_uppercase_change.txt
Created July 21, 2023 10:38
Dont Ignore case changes in git
# Global
git config --global core.ignorecase false
# local
git config --local core.ignorecase false
@Dadangdut33
Dadangdut33 / type_hint_in_circular_import.py
Last active July 21, 2023 15:28
Type hint / type checking in a circular import loop in python
# GlobalClass.py
from typing import Optional, TYPE_CHECKING
if TYPE_CHECKING:
from MainWindow import MainWindow # Forward declaration for type hinting
class GlobalClass:
def __init__(self):
self.mw: Optional[MainWindow] = None
self.x = 1
@Dadangdut33
Dadangdut33 / Install CUDA for TensorFlow in WSL2 (Win 10).md
Created September 13, 2023 16:22 — forked from adwellj/Install CUDA for TensorFlow in WSL2 (Win 10).md
Instructions for installing CUDA for TensorFlow 2.8 in Ubuntu 20.04 in WSL2 (Win 10 - 02/2022)

Confirm GPU access in WSL

In an Ubuntu terminal, enter nvidia-smi. If that fails, make sure your Nvidia drivers are up-to-date (current version: 511.23). Win10 version also needs to be at least 21H2 (Winkey + R then winver in Windows to check version).

Current versions of TF use CUDA 11.2 and cuDNN 8.1. Tested build configurations Run the below commands in a terminal:

wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pin
sudo mv cuda-wsl-ubuntu.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/11.2.2/local_installers/cuda-repo-wsl-ubuntu-11-2-local_11.2.2-1_amd64.deb
  1. Install CUDA 11.8 first
$ wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pin
$ sudo mv cuda-wsl-ubuntu.pin /etc/apt/preferences.d/cuda-repository-pin-600
$ wget https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda-repo-wsl-ubuntu-11-8-local_11.8.0-1_amd64.deb
$ sudo dpkg -i cuda-repo-wsl-ubuntu-11-8-local_11.8.0-1_amd64.deb
$ sudo cp /var/cuda-repo-wsl-ubuntu-11-8-local/cuda-*-keyring.gpg /usr/share/keyrings/
$ sudo apt-get update
$ sudo apt-get -y install cuda
@Dadangdut33
Dadangdut33 / Get_Checksum.md
Created November 28, 2023 08:52
Function to Get Checksum of File with Powershell and write it (SHA1, SHA256, SHA384, SHA512, MD5)

About

Powershell support the following hashing algorithm:

  • SHA1
  • SHA256
  • SHA384
  • SHA512
  • MD5

I created simple script that you can add to your powershell $PROFILE

@Dadangdut33
Dadangdut33 / PhoneNumber.tsx
Created March 8, 2024 16:26
Mantine UI Phone Number Input with react-phone-number-input
import { Input as MantineInput, TextInput } from "@mantine/core";
import { UseFormReturnType } from "@mantine/form";
import { LegacyRef, forwardRef } from "react";
import PhoneInput, { DefaultInputComponentProps, Value } from "react-phone-number-input";
import "react-phone-number-input/style.css";
// eslint-disable-next-line react/display-name
const CustomInput = forwardRef((inputProps: DefaultInputComponentProps, ref: LegacyRef<HTMLInputElement>) => {
const { error, ...rest } = inputProps;
return (