Skip to content

Instantly share code, notes, and snippets.

View Enter-tainer's full-sized avatar
💭
I may be slow to respond.

Wenzhuo Liu Enter-tainer

💭
I may be slow to respond.
View GitHub Profile
custom_proxy_group=Proxies`select`[]HK`[]SG`[]JP`[]US`[]TW`[]JP`[]US`[]ID`[]FR`[]AU`[]UK`[]KR`[]RU`[]V6`.*
custom_proxy_group=HK`select`港|HK
custom_proxy_group=SG`select`新加坡|狮城|SG
custom_proxy_group=TW`select`台|新北|彰化|TW
custom_proxy_group=JP`select`日((?!用).)+|东京|大阪|埼玉|JP
custom_proxy_group=US`select`美|洛杉矶|硅谷|达拉斯|费利蒙|凤凰城|芝加哥|圣何塞|西雅图|US|CA|加拿大
custom_proxy_group=ID`select`India|印度
custom_proxy_group=FR`select`France|法国
custom_proxy_group=AU`select`AU|澳|悉尼
custom_proxy_group=UK`select`UK|英|爱尔兰|伦敦
@Enter-tainer
Enter-tainer / cheat.cu
Created May 21, 2021 06:43
cuda thread id
//1D grid of 1D blocks
__device__ int getGlobalIdx_1D_1D()
{
return blockIdx.x *blockDim.x + threadIdx.x;
}
//1D grid of 2D blocks
__device__ int getGlobalIdx_1D_2D()
{
return blockIdx.x * blockDim.x * blockDim.y + threadIdx.y * blockDim.x + threadIdx.x;
@Enter-tainer
Enter-tainer / index.md
Created February 9, 2021 15:27
WakaTime Status

@Enter-tainer
Enter-tainer / nim.hs
Created May 22, 2020 11:45
输出 nim 游戏的决策树
import Data.Tree
import Data.List
import Data.Bits
type Vec = [Int]
data Nim = Nim Vec Int Bool
instance Show Nim where
show (Nim v _ True) = show $ (v, 1)
show (Nim v _ False) = show $ (v, -1)

Keybase proof

I hereby claim:

  • I am enter-tainer on github.
  • I am margatroid (https://keybase.io/margatroid) on keybase.
  • I have a public key ASD3Iwet5lJf9UEyPRNzMz-IOkTGS4uMk4lFVP1i_5o1Qwo

To claim this, I am signing this object:

@Enter-tainer
Enter-tainer / rewritemetadata.js
Created December 31, 2019 05:15
rewrite meta data of mp3
const NodeID3 = require('node-id3')
const util = require("util");
const readline = require('readline');
const fs = require('fs');
const path = require('path');
const readInterface = readline.createInterface({
input: fs.createReadStream('files.txt'),
output: process.stdout,
@Enter-tainer
Enter-tainer / is_stl.cpp
Created October 21, 2019 14:01
detect if a T have begin() and end()
template <typename, typename = void> struct is_stl : std::false_type {};
template <typename T>
struct is_stl<T, std::void_t<decltype(std::declval<T>().begin(),
std::declval<T>().end())>>
: std::true_type {};
template <typename T>
typename std::enable_if<!is_stl<T>::value, std::string>::type
your_func(const T& v) {
@Enter-tainer
Enter-tainer / concat.sh
Created October 10, 2019 13:20
concat videos
for f in ./*.ts; do echo "file '$f'" >> mylist.txt; done
ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.ts
@Enter-tainer
Enter-tainer / type_of.cpp
Last active October 14, 2019 07:22
:t for cpp
#include <algorithm>
#include <bitset>
#include <cstdint>
#include <cxxabi.h>
#include <iomanip>
#include <iostream>
#include <string>
#include <type_traits>
#include <vector>
using namespace std;
#include <bits/stdc++.h>
using namespace std;
namespace mgt {
enum print_base {
bin = 2, oct = 8, dec = 10, hex = 16
};
template <typename T>