Skip to content

Instantly share code, notes, and snippets.

@evanesoteric
evanesoteric / nftables.conf
Created December 11, 2023 04:36
Nftables ruleset
#!/usr/bin/nft -f
flush ruleset
# home, office
# define admin = { 10.10.10.10. 172.10.10.10 }
table nat {
chain prerouting {
type nat hook prerouting priority 0
@osy
osy / xg_mobile_connector.md
Last active April 25, 2024 10:50
XG Mobile Connector Notes

These are notes written up about the XG Mobile connector which is found on the Asus ROG Ally as well as some ROG Flow models. The goal is to build a custom eGPU enclosure that is compatible with the XG Mobile connector.

XG Mobile Cable

The XG Mobile Cable comes with ROG XG Mobile and can be purchased from a [parts store][2] for $129 USD. It has a male XG Mobile Connector on one end and three cables on the other end: two 40-pin FPC cables and a 8-pin connector. The cable carries a USB-C connection, PCIe x8 signal pairs, PCIe clock, an SMBus/I2C connection, and some sideband signals for power detection and hot-plug support.

XG Mobile Connector

The pinout can be obtained from the [GV301QC schematic][1] (page 69).

Pin Name Pin Name
C1 PCIENB_TXP0_C D1 PCIENB_TXP5_C
# pip install webdriver_manager
# pip install selenium
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from time import sleep
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from webdriver_manager.chrome import ChromeDriverManager
@choco-bot
choco-bot / Update-AUPackages.md
Last active April 25, 2024 10:47
Update-AUPackages Report #powershell #chocolatey
@jauderho
jauderho / Public time servers with anycast NTP support.md
Last active April 25, 2024 10:47
This is a curated list of NTP time servers that have anycast IP addresses. This is useful for devices/appliances that can only use IP addresses for defined NTP servers.

Cloudflare (AS13335)

server 162.159.200.123

server 162.159.200.1

Facebook (AS32934)

server 129.134.28.123 # SJC

@fjudith
fjudith / kubernetes_service_session_affinity.md
Last active April 25, 2024 10:48
Enable Session Affinity (a.k.a Sticky Session) to Kubernetes service
@duchelle5093
duchelle5093 / hello.c
Created April 25, 2024 10:41
mon hello world
int main ()
{
print("hello world");
return 0;
}
@TrueCarry
TrueCarry / check.ts
Last active April 25, 2024 10:41
TON Connect V2 Proof verification
async function check(req, res) {
const walletInfo = req.body.walletInfo as Wallet
if (!walletInfo?.connectItems?.tonProof) {
return res.status(httpStatus.BAD_REQUEST).send({ ok: false })
}
const proof = walletInfo.connectItems.tonProof as TonProofItemReplySuccess
if (!proof) {
return res.status(httpStatus.BAD_REQUEST).send({ ok: false })
}
@chrislemke
chrislemke / compute_metrics.py
Created July 15, 2021 12:40
Compute metrics for training process
from datasets import load_metric
meteor = load_metric('meteor')
rouge = load_metric('rouge')
def compute_metrics(prediction):
labels_ids = prediction.label_ids
pred_ids = prediction.predictions
pred_str = tokenizer.batch_decode(pred_ids, skip_special_tokens=True)
@noelboss
noelboss / git-deployment.md
Last active April 25, 2024 10:38
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.