Skip to content

Instantly share code, notes, and snippets.

View ruipeterpan's full-sized avatar
🖖

Rui Pan 潘瑞 ruipeterpan

🖖
View GitHub Profile
@jackblk
jackblk / LogitechF310_Macbook.MD
Created April 13, 2021 16:07
Getting Logitech F310 to work with Macbook USB-C port

Connect & use Logitech F310 with Macbook

Since my Macbook Pro only has USB-C port, I used an USB-A to USB-C adapter to connect my F310 to it, but it does not work (pressing MODE button does not turn on the LED).

How to

To make it work:

  • Disconnect F310 from Mac
  • On F310: switch X-input to D-input
  • Hold Logitech button (in the middle)
  • Connect F310 to Mac via adapter, now you can release the Logitech button.
@kunaldua
kunaldua / FootballFixtures.js
Last active November 14, 2020 20:26
Show the latest result/ upcoming fixtures of football (soccer) teams using TheSportsDB.com API
// Based almost entirely on the work of https://gist.github.com/ilyichvismara/7895bb479e14a999f3cfd2c391f10597
const teamId = 133811; // Replace this with your team's ID — find the team page on https://www.thesportsdb.com, e.g. Arsenal's page is https://www.thesportsdb.com/team/133604 so their teamID is 133604
const teamDetailUrl = "https://www.thesportsdb.com/api/v1/json/1/lookupteam.php?id=";
const leagueDetailUrl = "https://www.thesportsdb.com/api/v1/json/1/lookupleague.php?id="
const teamUrl = teamDetailUrl + teamId;
let r = new Request(teamUrl);
let teamDetail = await r.loadJSON();

Upcoming Matches ⚽

This easy widget let's you see upcoming matches of your favourite football team.

Guide

  1. Copy this code in a new script in Scriptable app
  2. Find teamId here: https://site.api.espn.com/apis/site/v2/sports/soccer/:league/teams
  3. Find league id: some league abbreviation (EX: 'eng.1' for EPL, 'usa.1' for MLS, 'ned.1' for Dutch Eredivisie)
  4. Change competitionId variable (line 4) with your competition id
  5. Change teamId variable (line 5) with your favourite team id
@rishavpandey43
rishavpandey43 / git-commit-styleguide.md
Last active June 24, 2024 12:35
This gist consist of the rules and best practice of good conventional git commit message

Git Commit Messages Style-Guides

  • Use the present tense ("Add feature" not "Added feature")
  • Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
  • Limit the first line to 72 characters or less
  • Reference issues and pull requests liberally after the first line
  • When only changing documentation, include [ci skip] in the commit title
  • Consider starting the commit message with an applicable emoji

Types

@mcarilli
mcarilli / commands.md
Last active June 11, 2024 20:13
Single- and multiprocess profiling workflow with nvprof and NVVP (Nsight Systems coming soon...)

Ordinary launch commands (no profiling):

Single-process:

python main_amp.py -a resnet50 --b 224 --deterministic --workers 4 --opt-level O1 ./bare_metal_train_val/

Multi-process:

python -m torch.distributed.launch  --nproc_per_node=2 main_amp.py -a resnet50 --b 224 --deterministic --workers 4 --opt-level O1 ./bare_metal_train_val/
@W4ngatang
W4ngatang / download_glue_data.py
Last active May 23, 2024 12:55
Script for downloading data of the GLUE benchmark (gluebenchmark.com)
''' Script for downloading all GLUE data.
Note: for legal reasons, we are unable to host MRPC.
You can either use the version hosted by the SentEval team, which is already tokenized,
or you can download the original data from (https://download.microsoft.com/download/D/4/6/D46FF87A-F6B9-4252-AA8B-3604ED519838/MSRParaphraseCorpus.msi) and extract the data from it manually.
For Windows users, you can run the .msi file. For Mac and Linux users, consider an external library such as 'cabextract' (see below for an example).
You should then rename and place specific files in a folder (see below for an example).
mkdir MRPC
cabextract MSRParaphraseCorpus.msi -d MRPC
@Cartexius
Cartexius / install_gtest_ubuntu.md
Last active May 28, 2024 06:01
Install gtest in Ubuntu
@denilsonsa
denilsonsa / README.md
Last active May 1, 2024 11:37
Train Conductor World - tiled map

Train Conductor World - tiled map

[Train Conductor World][tcw] is mobile game (for [iOS][ios] and [Android][and]) by [The Voxel Agents][tva]. The game has several cities on a world map (currently, only European cities).

This project (i.e. this GitHub Gist) is an effort to replicate the game world map outside the game. For that, I've used [Tiled Map Editor][tiled] to rebuild the map, and [Gimp][gimp] to create the graphics. This map can be used in the future to help planning in-game routes.

The graphics are based on [in-game screenshots][ss].

@sonots
sonots / nvvp.md
Last active April 24, 2024 13:54
How to use NVIDIA profiler

Usually, located at /usr/local/cuda/bin

Non-Visual Profiler

$ nvprof python train_mnist.py

I prefer to use --print-gpu-trace.

@pierrejoubert73
pierrejoubert73 / markdown-details-collapsible.md
Last active June 29, 2024 15:54
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux