Skip to content

Instantly share code, notes, and snippets.

View crosstyan's full-sized avatar

Crosstyan crosstyan

View GitHub Profile
@crosstyan
crosstyan / How to use ssh-copy-id.md
Created July 21, 2025 06:33 — forked from CharlesGodwin/How to use ssh-copy-id.md
Windows 10/11 scripts to support ssh-copy-id which is missing in Windows OpenSSH

The Windows version of OpenSSH client doesn't include a ssh-copy-id command. I don't know why. If it does one day, then this can be ignored.

NOTE If you have Windows Subsystem for Linux (WSL) installed, you can use the linux version of ssh-copy-id instead. Go to the description at the end of this document.

  • Download the file ssh-copy-id.cmd to your Windows PC, or copy and paste its contents.
  • Run the script passing your linux ssh information (for example ssh-copy-id.cmd [email protected]). This should work with any Linux platform. Alternatively, if you have experience, you can use the powershell version. ssh-copy-id.ps1. Run the script as powershell .\ssh-copy-id.ps1 [email protected].
  • Run the command for each linux account you connect with. You will be prompted for your Linux host password. If you have more than 1 account on any machine, you must do this for each account.

The file name and location of the script is not important but the filename extension must be .cmd

#ifndef _Static_assert
/* https://en.cppreference.com/w/c/language/_Static_assert
* https://en.cppreference.com/w/c/keyword/static_assert
* check if C23 or C++
*/
#if defined(__cplusplus) || \
(defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L)
#define _Static_assert static_assert
#else
#include <assert.h>
@crosstyan
crosstyan / check_bitfield_order.cpp
Last active August 21, 2024 17:01
check bitfield order of struct
#include <cstdint>
#include <cstdio>
enum class StructBitfieldOrder {
/// the most significant bit as the first appearing field in a struct
MSB_AS_FIRST_FIELD,
/// the least significant bit as the first appearing field in a struct
LSB_AS_FIRST_FIELD,
/// should not happen
OTHER,
@crosstyan
crosstyan / proxy.ps1
Created July 23, 2024 18:11
set proxy environment variable
# Set-ExecutionPolicy -ExecutionPolicy Unrestricted
$proxy_host = "http://192.168.5.2"
$proxy_port = 36000
$before_path = Get-Location
function remove-env($name) {
$before= Get-Location
try {
# https://stackoverflow.com/questions/8388650/powershell-how-can-i-stop-errors-from-being-displayed-in-a-script
Set-Location Env:
@crosstyan
crosstyan / cv.py
Last active June 12, 2024 19:28
a stupid anyio with multiprocess
import random
import time
from multiprocessing import cpu_count
from typing import (
Any,
Awaitable,
Callable,
Final,
Generic,
Iterable,
@crosstyan
crosstyan / counter.m
Last active May 24, 2024 07:43
a demo of closure with Matlab (R2023b)
% https://www.mathworks.com/matlabcentral/answers/439671-why-i-cannot-define-a-function-in-live-script
[inc, get] = createCounter();
inc();
inc();
disp(get());
% https://www.mathworks.com/help/matlab/function-handles.html
obj = createCounterMap();
disp(obj);
@crosstyan
crosstyan / rsync-rootfs.md
Created April 8, 2024 04:46 — forked from kalaksi/rsync-rootfs.md
Copy the whole root filesystem excluding pseudo-filesystems and mountpoints

Copying the whole linux root filesystem locally or remotely using rsync

Explanation of chosen options:

  • Verbose output with speed and progress information
  • Try to preserve all possible information: file attrs, hardlinks, ACLs and extended attrs,
  • Exclude contents of pseudo-filesystems and mountpoints
  • In this example source host is remote and destination local.
rsync --info=progress2  -vaHAX --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} source.host:/ /local/destination
@crosstyan
crosstyan / example.ipynb
Last active March 13, 2024 03:55
an example to parse NOAA hurricanes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@crosstyan
crosstyan / webrtc_for_work.rst
Created January 10, 2024 15:57 — forked from voluntas/webrtc_for_work.rst
仕事で WebRTC

仕事で WebRTC

日時:2023-01-15
作:@voluntas
バージョン:2023.1
url:https://voluntas.github.io/

この資料は以下の製品の宣伝を含みます。

@crosstyan
crosstyan / cpp.std.coroutines.draft.md
Created December 26, 2023 17:36 — forked from MattPD/cpp.std.coroutines.draft.md
C++ links: Coroutines (WIP draft)