Skip to content

Instantly share code, notes, and snippets.

View BlurryLight's full-sized avatar
🎯
Focusing on RealtimeRendering

BlurryLight BlurryLight

🎯
Focusing on RealtimeRendering
View GitHub Profile
@BlurryLight
BlurryLight / gist:2687663b243e2514ce70aeaa527c04ce
Last active December 27, 2019 05:13
colab/ kaggle snippets

colab mount drive

from google.colab import drive
drive.mount('/content/gdrive')

install pytorch 1.2

!pip install torch==1.2.0 torchvision==0.4.0 -f https://download.pytorch.org/whl/torch_stable.html

install pytorch apex

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDn/c1VdIrM6Uz11c1Bi1HPJyonhLbDCFaJWb7sf9O2Th7GkymumE+lwaX8rKd5W28m5JSpO9JIKePMXgrvnWU4PnFrBWIp9rwhOZXLi76MvdRVGioys3BI6klZiBqZXiBkkoa3kvuU9ESfftKnJYYt5LMaG2sR4TKk0/VZcre6pQkuTe2nbJrBKDMkTjlaReT+bk3HVcC3R3OpgH7jnMOv3SvKaCgxq/NQDEz+2TQmurr/5tEYCU0yzA55/Z8uvuokPeXmHpNGFJamUbO1YH0BeDVcIsaphax6gsODSN1eeGXV3/iXRUtzro5h+J3iyQC4uf2dLxfYhhBPRQYPBhGA65s/hQf6MhHwxfPPu9OSbZEnZUZeHj0/QlmWy+EGpeedJNIutHpXUH1xXDNl94DPaZOjZOPzwRma2fe6LVaboOrGv8QJAE4Rpk2jhssMvsv+UreVpWcj1OlljYQbeprz/ki9huILxoputj4Xno99l3SI/VQ3CTB5aImmD1dYHEgrRJBwWNYFJ9uNgxZsIcBVrRkNCPO/q9ClVKDaUvUDQl0w/hgo5EGhs73akUtEqkcvx2FUaCxzASJw3XrPWgvkIRiM1Xu1pUofDm+KA4PpTNhjlMtRvkWyvalX47gwBH28UFa1USdzn5kBuieLw/0xADLrMRNwpWdZyR1ZedGMKQ== [email protected]
function LookupDate(input)
local fmt
if input == '' then
fmt = "%Y年%m月%d日"
elseif input == 't' then
fmt = "%Y-%m-%d %H:%M:%S"
elseif input == 'd' then
fmt = "%Y-%m-%d"
end
@BlurryLight
BlurryLight / gist:4b4326be785eeeb53baa73030a2bd8e8
Created May 27, 2020 12:22
linux-disable/enable-laptop-internal-keyboard
#!/usr/bin/env python
#encoding: utf-8
import subprocess
import sys
keyboard_id = subprocess.check_output("xinput list | grep 'AT Translated Set' | cut -f2 | cut -d'=' -f2",shell=True).decode('utf-8').strip('\n')
master_keyboard_id = subprocess.check_output("xinput list | grep 'master keyboard' | cut -f2 | cut -d'=' -f2",shell=True).decode('utf-8').strip('\n')
if len(sys.argv) > 1:
if(sys.argv[1] == 'detach'):
TypeScript 8 hrs 39 mins ██████████████▉░░░░░░ 70.8%
Markdown 1 hr 2 mins █▊░░░░░░░░░░░░░░░░░░░ 8.6%
ERB 49 mins █▍░░░░░░░░░░░░░░░░░░░ 6.7%
C++ 40 mins █▏░░░░░░░░░░░░░░░░░░░ 5.5%
C# 23 mins ▋░░░░░░░░░░░░░░░░░░░░ 3.2%
@BlurryLight
BlurryLight / profile.ps1
Last active March 10, 2022 11:32
profile
function Invoke-Environment {
# from https://github.com/majkinetor/posh/blob/master/MM_Admin/Invoke-Environment.ps1
param
(
# Any cmd shell command, normally a configuration batch file.
[Parameter(Mandatory=$true)]
[string] $Command
)
$Command = "`"" + $Command + "`""
@BlurryLight
BlurryLight / CMakePresets.json
Created March 24, 2022 15:55
CMakePresets.json(vcpkg + MSVC + gcc + clang)
{
"version": 3,
"configurePresets": [
{
"name": "base",
"description": "For more information: http://aka.ms/cmakepresetsvs",
"hidden": true,
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/${presetName}",
"installDir": "${sourceDir}/install/${presetName}",
@BlurryLight
BlurryLight / convert_csv_excel.py
Created April 2, 2022 13:27
convert csv excel
import win32com.client as win32
from win32com.client import constants
from pathlib import Path
excel = win32.gencache.EnsureDispatch('Excel.Application') # office
# excel = win32.gencache.EnsureDispatch('ket.Application') # wps
excel.Visible = False
input_path = Path("input.csv").absolute()
output_path = Path(".").absolute()
csv = excel.Workbooks.Open(str(input_path))
@BlurryLight
BlurryLight / utf8_16cvt.cc
Created April 6, 2022 16:31
utf8 utf16 convert
std::string utf16_to_utf8(std::u16string const &s) {
std::wstring_convert<
std::codecvt_utf8_utf16<char16_t, 0x10ffff,
std::codecvt_mode::little_endian>,
char16_t>
cnv;
std::string utf8 = cnv.to_bytes(s);
if (cnv.converted() < s.size())
throw std::runtime_error("incomplete conversion");
return utf8;
@BlurryLight
BlurryLight / future.h
Created April 9, 2022 16:52
promise_future
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0