Discover gists
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.PrintWriter | |
import java.net.{ServerSocket, Socket} | |
import scala.concurrent.Future | |
import java.io.BufferedReader | |
import java.io.InputStreamReader | |
import scala.collection.mutable | |
class Server(port: Int) { |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Updated 2023-12-11: Hosts calculation updated to support CIDR or 31 and 32.
Prerequisites:
- A1 contains an IP address, such as 10.0.0.2
- B1 contains the number of bits in the netmask (CIDR) such as 24
The below formulas then go into C1, D1 etc. to perform the various calculations. Some calculations depends on other calculations.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tiktoken | |
import langdetect | |
T = tiktoken.get_encoding("o200k_base") | |
length_dict = {} | |
for i in range(T.n_vocab): | |
try: | |
length_dict[i] = len(T.decode([i])) | |
except: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo dpkg --add-architecture armhf | |
sudo apt-get update | |
sudo apt-get install libc6:armhf | |
sudo ln -s /lib/ld-linux-armhf.so.3 /lib/ld-linux.so.3 | |
sudo apt-get install libstdc++6:armhf | |
sudo wget https://www.vpn.net/installers/logmein-hamachi_2.1.0.203-1_armhf.deb | |
sudo dpkg -i logmein-hamachi_2.1.0.203-1_armhf.deb | |
sudo hamachi login | |
sudo hamachi attach-net my@mail.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# secret-key | |
# Generate an app secret key | |
from base64 import b64encode | |
from os import urandom | |
random_bytes = urandom(64) | |
token = b64encode(random_bytes).decode() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Download dwebp (WebP decoder tool) https://developers.google.com/speed/webp/download | |
#Run | |
for %f in (*.webp) do dwebp.exe "%f" -o "%~nf.png" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# These are meant to work in both Python 2 and 3, except where noted. | |
# See my useful_pandas_snippets.py for those related to dataframes (such as pickling/`df.to_pickle(save_as)`) | |
# https://gist.github.com/fomightez/ef57387b5d23106fabd4e02dab6819b4 | |
# also see https://gist.github.com/fomightez/324b7446dc08e56c83fa2d7af2b89a33 for examples of my | |
# frequently used Python functions and slight variations for more expanded, modular structures. | |
#argparse | |
# good snippet collection at https://mkaz.tech/code/python-argparse-cookbook/ |
NewerOlder