Skip to content

Instantly share code, notes, and snippets.

View SSARCandy's full-sized avatar
🔭
💤

Andy Hsu SSARCandy

🔭
💤
View GitHub Profile
@SSARCandy
SSARCandy / gpu-occupy-status.sh
Last active August 26, 2021 17:18
Show GPU occupying status in dgx-1 (using nvidia-smi)
#!/bin/bash
function show_gpu_user {
pid=$(pstree -sg $1 | grep -Eo 'bash\([0-9]*\)' | head -1 | grep -Eo '[0-9]*');
docker ps -q | xargs docker inspect --format "{{.Name}} {{.State.Pid}}" | grep $pid | awk '{printf "%-24s", $1}';
ps aux | grep $1 | grep -v grep | awk '{ for(i=1;i<=NF;i++) {if ( i >= 11 ) printf $i" "}; printf "\n" }';
}
echo " ";

在 Facebook 上分享 Dcard 文章時,如果沒有指定圖片的話,可能會看到如下的文章摘要:

這張圖片是透過 Go library draw2d 產生的,它有類似 HTML5 canvas 的 API,所以畫一些簡單的圖形都還算小菜一碟,然而在處理文字上就沒這麼得心應手了。

初次嘗試

src, _ := loadBaseImageForPost(post)
@SSARCandy
SSARCandy / opencv_with_cmake.md
Last active April 15, 2024 02:25
Setting up OpenCV(+extra modules) with Cmake step by step tutorial

Setting up OpenCV with Cmake GUI

  1. Download OpenCV and Cmake
  2. Build opencv with cmake image
  • Press configure, choose visual studio 2015, finish
  • Then press generate
  1. Open OpenCV.sln under build/
  2. Build it using Debug, Release
    image
@vsouza
vsouza / .bashrc
Last active June 14, 2024 08:45
Golang setup in Mac OSX with HomeBrew. Set `GOPATH` and `GOROOT` variables in zshell, fish or bash.
# Set variables in .bashrc file
# don't forget to change your path correctly!
export GOPATH=$HOME/golang
export GOROOT=/usr/local/opt/go/libexec
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin
@zaphoyd
zaphoyd / basic_client.cpp
Last active June 4, 2023 08:39
An example of a basic WebSocket++ client that sends a message, waits for a response, then closes the connection
#include <websocketpp/config/asio_no_tls_client.hpp>
#include <websocketpp/client.hpp>
#include <iostream>
typedef websocketpp::client<websocketpp::config::asio_client> client;
using websocketpp::lib::placeholders::_1;
using websocketpp::lib::placeholders::_2;
@coolaj86
coolaj86 / how-to-publish-to-npm.md
Last active June 9, 2024 23:19
How to publish packages to NPM

Getting Started with NPM (as a developer)

As easy as 1, 2, 3!

Updated:

  • Aug, 08, 2022 update config docs for npm 8+
  • Jul 27, 2021 add private scopes
  • Jul 22, 2021 add dist tags
  • Jun 20, 2021 update for --access=public
  • Sep 07, 2020 update docs for npm version