Skip to content

Instantly share code, notes, and snippets.

View hotpxl's full-sized avatar

Yutian Li hotpxl

View GitHub Profile
@hotpxl
hotpxl / README.md
Last active March 1, 2023 03:43
Connect Microsoft Flight Simulator on Shadow to ForeFlight

Background

ForeFlight listens to UDP traffic on port 49002 for information from flight simulators. It integrates GPS, AHRS, and traffic data, giving you a very similar experience to an ADS-B In unit.

Microsoft Flight Simulator doesn't natively support this, but fs2ff is a very easy-to-use plugin that bridges the gap. You can download an executable binary from the release page and you are ready to go.

However, I run Microsoft Flight Simulator on Shadow, and to show flight information on my local ForeFlight, I need to forward the flight data. The following steps should technically work with other cloud gaming platforms as well.

Steps

  1. On your local network's router, enable port forwarding so UDP traffic from the public interface's port 49002 can reach the local iPad.
  2. Start Microsoft Flight Simulator and fs2ff. In fs2ff, deselect Auto-detect and enter 127.0.0.1 for the IP address.
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from __future__ import print_function
import csv
import re
import datetime
def get_service_ids(today):
service_ids = set()
@hotpxl
hotpxl / remove_xattr.c
Last active December 27, 2022 20:28
Remove extra extended attributes
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/xattr.h>
char const* kPatterns[] = {
"com.apple.quarantine", "com.apple.lastuseddate#PS",
"com.apple.metadata:kMDItemWhereFroms",
"com.apple.metadata:_kMDItemUserTags",
"com.apple.metadata:kMDLabel_nhfihrek4vfesitn3irk5qye5q"};
@hotpxl
hotpxl / README.md
Last active March 2, 2017 14:21
MinPy next step prototype

MinPy Next Step Prototype

Run it with Python 3. Not tested with Python 2 and most probably will not run for now.

This just shows how JIT and gradient code generation works together. Execution and optimization are just placeholders. They will be hooked to NNVM.

@hotpxl
hotpxl / get-sshfp.sh
Created September 8, 2016 07:12
Get SSHFP record
#!/bin/bash
set -euo pipefail
print_usage() {
printf "Usage: %s <fully qualified domain names>...\n" "$(basename "$0")"
exit 1
}
if [[ "$#" -lt 1 ]]; then
print_usage
@hotpxl
hotpxl / log.py
Last active May 19, 2016 03:44
Logging utilities
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Logging utilities."""
import logging
CRITICAL = logging.CRITICAL
ERROR = logging.ERROR
WARNING = logging.WARNING
INFO = logging.INFO
DEBUG = logging.DEBUG
@hotpxl
hotpxl / change_backlight
Created August 5, 2015 12:40
Utilities for laptop access
#!/usr/bin/zsh
case "$1" in
+)
ACTION="-inc";;
-)
ACTION="-dec";;
*)
echo "invalid option";
exit 1;;
@hotpxl
hotpxl / dvorak.reg
Last active April 26, 2019 07:53
Dvorak keyboard layout for Windows
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"ScanCode Map"=hex:00,00,00,00,00,00,00,00,22,00,00,00,2d,00,30,00,24,00,2e,00,\
11,00,33,00,33,00,11,00,12,00,20,00,34,00,12,00,1b,00,0d,00,0d,00,1b,00,16,\
00,21,00,17,00,22,00,20,00,23,00,1a,00,0c,00,2e,00,17,00,23,00,24,00,14,00,\
25,00,31,00,26,00,35,00,1a,00,30,00,31,00,13,00,18,00,26,00,19,00,2f,00,34,\
00,28,00,10,00,0c,00,28,00,19,00,13,00,18,00,1f,00,1f,00,27,00,2c,00,35,00,\
15,00,14,00,22,00,16,00,25,00,2f,00,10,00,2d,00,21,00,15,00,27,00,2c,00,00,\
00,00,00
@hotpxl
hotpxl / IDS.py
Last active August 29, 2015 14:07
from scapy.all import *
from random import randint
payload = 'GET /proxy.org HTTP/1.1\r\nUser-Agent: curl/7.35.0\r\nHost: mit.edu\r\n\r\n'
ip = '23.66.32.128'
sport = randint(30000, 50000)
if __name__ == '__main__':
@hotpxl
hotpxl / depot-using-monitor.c
Created April 23, 2014 14:30
Monitor solution for Chapter 2 Exercise 1 Extension 1 from 操作系统之PV金典
#include <stdio.h>
#include <proc.h>
#include <sem.h>
#include <monitor.h>
#define N 3
#define M 4
#define TIMES 10
int numberA;