Skip to content

Instantly share code, notes, and snippets.

@smarr
smarr / truffle-material.md
Last active May 9, 2024 08:19
Truffle: Languages and Material
@SashaKryzh
SashaKryzh / app_colors_extension.dart
Last active May 9, 2024 08:18
Flutter ThemeExtension for custom app colors.
import 'package:flutter/material.dart';
/// `ThemeExtension` template for custom colors.
///
/// For example purposes, it has all required fields from the default Material `ColorScheme`.
/// But you can add, rename and delete any fields your need.
///
/// ### Motivation
///
/// At the beginning, you may not know if your colors will fit into the Material `ColorScheme`,
[
{
"bindings": {
// Built-in
"ctrl-g": "menu::Cancel",
"ctrl-x 5 2": "workspace::NewWindow",
"ctrl-x ctrl-c": "zed::Quit",
"ctrl-x ctrl-f": "workspace::Open",
"ctrl-x k": "pane::CloseActiveItem",
"ctrl-x o": "workspace::ActivateNextPane",
@ravikyada
ravikyada / swapper.sh
Created May 9, 2024 08:16
Create Swap File Inside Debian Server
#! /usr/bin/bash
read -p "Give size of swap you wants to create:" usr_input
echo "Your swap memory will be create of size : $usr_input"
sudo fallocate -l $usr_input /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon --show
@qingwei91
qingwei91 / multiplayer-game-networking1.md
Last active May 9, 2024 08:15
How does Multiplayer Game sync their state? Part-1

The problem in multiplayer game

In multiplayer game, one of the most complex issue is to keep all player's state in sync with server state. There are a few good articles around this topic on the internet. However, some details are missing here and there, which may be confusing for beginners in field of game programming, I hope I can clear things up in this article.

I'll present a few techniques commonly used in this problem space.

Before we jump into the problem, let's have an overview on how multiplayer game generally works.

Typically, a game program needs to simulate

@jkjuopperi
jkjuopperi / gist:e2fefa48c79bafb59b23ffefa8384bb3
Last active May 9, 2024 08:13
MikroTik wireless channels
/interface wireless channels
add band=2ghz-b/g/n width=20 list=2GHz/20MHz frequency=2412 name=ch1
add band=2ghz-b/g/n width=20 list=2GHz/20MHz frequency=2437 name=ch6
add band=2ghz-b/g/n width=20 list=2GHz/20MHz frequency=2462 name=ch11
add band=5ghz-onlyac width=20 list=5GHz/80MHz extension-channel=Ceee frequency=5180 name=ch36/38/42
add band=5ghz-onlyac width=20 list=5GHz/80MHz extension-channel=eCee frequency=5200 name=ch40/38/42
add band=5ghz-onlyac width=20 list=5GHz/80MHz extension-channel=eeCe frequency=5220 name=ch44/46/42
add band=5ghz-onlyac width=20 list=5GHz/80MHz extension-channel=eeeC frequency=5240 name=ch48/46/42
@gakhov
gakhov / find_turning_points.py
Created August 7, 2015 15:07
Using Ramer-Douglas-Peucker algorithm construct an approximated trajectory and find "valuable" turning points.
from rdp import rdp
def angle(directions):
"""Return the angle between vectors
"""
vec2 = directions[1:]
vec1 = directions[:-1]
norm1 = np.sqrt((vec1 ** 2).sum(axis=1))
norm2 = np.sqrt((vec2 ** 2).sum(axis=1))
@eruvanos
eruvanos / README.md
Last active May 9, 2024 08:12
Simple mock server for testing using Flask

Mock server for testing using flask

License

MIT

Prepare

Install flask and requests to run this example.

@padeoe
padeoe / README_hfd.md
Last active May 9, 2024 08:12
CLI-Tool for download Huggingface models and datasets with aria2/wget+git

🤗Huggingface Model Downloader

Considering the lack of multi-threaded download support in the official huggingface-cli, and the inadequate error handling in hf_transfer, this command-line tool smartly utilizes wget or aria2 for LFS files and git clone for the rest.

Features

  • ⏯️ Resume from breakpoint: You can re-run it or Ctrl+C anytime.
  • 🚀 Multi-threaded Download: Utilize multiple threads to speed up the download process.
  • 🚫 File Exclusion: Use --exclude or --include to skip or specify files, save time for models with duplicate formats (e.g., *.bin or *.safetensors).
  • 🔐 Auth Support: For gated models that require Huggingface login, use --hf_username and --hf_token to authenticate.
  • 🪞 Mirror Site Support: Set up with HF_ENDPOINT environment variable.
@KhaosT
KhaosT / HDMI on Apple Vision Pro.md
Last active May 9, 2024 08:11
Guide for using Apple Vision Pro as HDMI display

Displaying HDMI sources on Apple Vision Pro

While it's possible to stream most content to Apple Vision Pro directly over the internet, having the ability to use Apple Vision Pro as an HDMI display can still be useful.

Since Apple Vision Pro does not support connecting to an HDMI input directly or using an HDMI capture card, we have to be a little creative to make this work. NDI provides the ability to stream HDMI content over a local network with really low latency, and it works great with Apple Vision Pro.

This page shows the setup I’m using.