In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of usecases of submodules:
- Separate big codebases into multiple repositories.
| import re | |
| from collections import defaultdict | |
| from marisa_trie import Trie | |
| wordlist = [li.strip() for li in open('wordlist.txt')] | |
| trie = Trie(wordlist) # สร้างครั้งเดียว ข้างนอก function | |
| class LatticeString(str): | |
| ''' String subclass เพื่อเก็บวิธีตัดหลายๆ วิธี | |
| ''' |
| Option Explicit | |
| Private Function XLMod(a, b) | |
| 'สำหรับใช้แทน mod ของ vba เนื่องจาก mod operator ของ vba ไม่รองรับเลขทศนิยม | |
| XLMod = a - b * Int(a / b) | |
| End Function | |
| Function AthikaMas(iYear As Integer) As Boolean | |
| 'สูตรสำหรับคำนวณปีอธิกมาส | |
| 'Return True if the specified year is AthikaMas. |
| from easydel import ( | |
| TrainArguments, | |
| AutoEasyDeLModelForCausalLM, | |
| EasyDeLOptimizers, | |
| EasyDeLSchedulers, | |
| EasyDeLGradientCheckPointers, | |
| SFTTrainer, | |
| conversations_formatting_function # i have added this one for newcomers so if they | |
| # don't know what's going on they can use this pre created prompter | |
| ) |
| # This is a modified version of TRL's `SFTTrainer` example (https://github.com/huggingface/trl/blob/main/examples/scripts/sft_trainer.py), | |
| # adapted to run with DeepSpeed ZeRO-3 and Mistral-7B-V1.0. The settings below were run on 1 node of 8 x A100 (80GB) GPUs. | |
| # | |
| # Usage: | |
| # - Install the latest transformers & accelerate versions: `pip install -U transformers accelerate` | |
| # - Install deepspeed: `pip install deepspeed==0.9.5` | |
| # - Install TRL from main: pip install git+https://github.com/huggingface/trl.git | |
| # - Clone the repo: git clone github.com/huggingface/trl.git | |
| # - Copy this Gist into trl/examples/scripts | |
| # - Run from root of trl repo with: accelerate launch --config_file=examples/accelerate_configs/deepspeed_zero3.yaml --gradient_accumulation_steps 8 examples/scripts/sft_trainer.py |
| # MIT License | |
| from web3 import Web3 # pip install web3 | |
| FoodcourtRouterAbi=[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_factory","internalType":"address"},{"type":"address","name":"_WETH","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"WETH","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"amountA","internalType":"uint256"},{"type":"uint256","name":"amountB","internalType":"uint256"},{"type":"uint256","name":"liquidity","internalType":"uint256"}],"name":"addLiquidity","inputs":[{"type":"address","name":"tokenA","internalType":"address"},{"type":"address","name":"tokenB","internalType":"address"},{"type":"uint256","name":"amountADesired","internalType":"uint256"},{"type":"uint256","name":"amountBDesired","internalType":"uint256"},{"type":"uint256","name":"amountAMin","internalType":"uint256"},{"type":"uint256","name":" |
| !pip install pythainlp |
| <!DOCTYPE html> | |
| <body> | |
| <?php | |
| session_start(); // ถ้าใช้งาน session อย่าลืม session_start(); | |
| if(isset($_POST["logout"])){ // มี SESSION ชื่อ checklogin ให้ทำในส่วนนี้ | |
| //unset($_SESSION['checklogin']); // ทำลาย SESSION ชื่อ checklogin | |
| $_SESSION['checklogin'] = false; // | |
| echo "ออกจากระบบแล้ว"; | |
| header("refresh: 2; url=./"); // รีเพจอีก 2 วินาที | |
| exit(0); |
| import os | |
| import re | |
| import sys | |
| import glob | |
| import nltk | |
| import gensim | |
| import numpy as np | |
| import pandas as pd | |
| from tqdm import tqdm | |
| from uuid import uuid4 |
| #Install Gource in Ubuntu | |
| ======================== | |
| #Go to the folder.... and | |
| #see http://tylerfrankenstein.com/code/install-gource-ubuntu-1010-visualize-git-repo | |
| # https://github.com/acaudwell/Gource/releases/download/gource-0.49/gource-0.49.tar.gz | |
| sudo apt-get update | |
| sudo apt-get install libglew-dev | |
| sudo apt-get install libsdl2-dev | |
| sudo apt install libsdl2-image-dev |