Skip to content

Instantly share code, notes, and snippets.

View NobodyXu's full-sized avatar

Jiahao XU NobodyXu

View GitHub Profile
@NobodyXu
NobodyXu / cargo-binstall-auditable-info.json
Created August 4, 2023 06:25
cargo-binstall auditable info
{
"packages": [
{
"name": "adler",
"version": "1.0.2",
"source": "crates.io"
},
{
"name": "ahash",
"version": "0.7.6",
@NobodyXu
NobodyXu / sway-config
Last active July 28, 2021 08:01
sway config
# Default config for sway
#
# Copy this to ~/.config/sway/config and edit it to your liking.
#
# Read `man 5 sway` for a complete reference.
xwayland enable
### Variables
#
@NobodyXu
NobodyXu / ErasedFnPointer.rs
Last active July 22, 2021 05:49
A safe type-erased Fn Pointer in rust that can be used to call associated and normal functions
use core::ffi::c_void;
use core::mem::transmute;
use core::ptr::null_mut;
use core::marker::PhantomData;
/// ErasedFnPointer can either points to a free function or associated one that
/// `&mut self`
struct ErasedFnPointer<'a, T, Ret> {
struct_pointer: *mut c_void,
fp: *const (),

Setup multiple git identities & git user informations

/!\ Be very carrefull in your setup : any misconfiguration make all the git config to fail silently ! Go trought this guide step by step and it should be fine 😉

Setup multiple git ssh identities for git

  • Generate your SSH keys as per your git provider documentation.
  • Add each public SSH keys to your git providers acounts.
  • In your ~/.ssh/config, set each ssh key for each repository as in this exemple:
@NobodyXu
NobodyXu / icecc-jobs.pl
Created March 20, 2021 23:47 — forked from mystor/icecc-jobs.pl
A simple script for counting the avaliable jobs in an icecream network
#!/usr/bin/env perl
# This short script queries the icecream scheduler to discover what machines are connected,
# and sums the maximum job counts for all x86-64 machines.
# It can be used in your mozconfig as follows:
# mk_add_options MOZ_MAKE_FLAGS="-j$(icecc-jobs)"
# if this script is on your PATH, and named icecc-jobs
use List::Util qw(sum0);
ssize_t read(int fd, void *buf, size_t count);
ssize_t write(int fd, const void *buf, size_t count);
@NobodyXu
NobodyXu / unity.md
Created January 23, 2020 03:30
Run vmware with unity using cygwin/x

Install cygwin/x

See here

Putty

Install putty, and then enter your virtual machine's IP, then go to Connection->ssh->X11, click Enable X11 forwarding and give the Xauthority file C:\Cygwin64\C:\cygwin64\home\${YOUR_USERNAME_HERE}\.Xauthority. Save the session with your favorite name to reuse the session.

@NobodyXu
NobodyXu / WSL.md
Last active January 23, 2020 03:23
Run WSL with GUI

cygwin/x

First, install cygwin/x. If no mirror are found, google 'cygwin/x mirrors' and you shall find many. Make sure xorg is always installed. Then, open "XWin server" file location from start menu, add -- -listen tcp to the end of target.

WSL

@NobodyXu
NobodyXu / Interesting_commands.md
Created December 2, 2019 12:05
Interesting commands
  1. tree: Display directory and its child dir (can be controlled via -L level) in tree.
@NobodyXu
NobodyXu / gen.sh
Created November 6, 2019 09:47
generating with seq quickly
seq 1 100000000 | parallel -k --pipe "sed 's/[0-9]*/https:\/\/&/'"