This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.example; | |
import com.fasterxml.jackson.annotation.JsonIgnore; | |
import com.fasterxml.jackson.annotation.JsonSubTypes; | |
import com.fasterxml.jackson.annotation.JsonTypeInfo; | |
import com.fasterxml.jackson.annotation.JsonTypeName; | |
import com.fasterxml.jackson.databind.ObjectMapper; | |
import lombok.Builder; | |
import lombok.SneakyThrows; | |
import lombok.Value; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// ref: [zhihu](https://zhuanlan.zhihu.com/p/378252833) | |
use crate::foo::{IncreaseOnly, new_increase_only}; | |
fn main() { | |
let mut x1 = new_increase_only!(0); | |
let mut x2 = new_increase_only!(2); | |
let y = 1; | |
// only can be used in `x1` | |
let le = x1.check_less_or_equal(y).unwrap(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE KindSignatures #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
module Main where | |
class Monad m => Handler (g :: * -> *) (m :: * -> *) where | |
handle :: g a -> (a -> m b) -> m b | |
data Freer :: (* -> *) -> * -> * where |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let langserver: ExampleLanguageServer | null = null; | |
export const activate = function() { | |
langserver = new ExampleLanguageServer(); | |
} | |
export const deactivate = function() { | |
if (langserver) { | |
langserver.stop(); | |
langserver = null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// see https://apple.stackexchange.com/a/430338/433504 | |
function fn() { | |
const cursorSizeSmall = 1 | |
const cursorSizeLarge = 4 | |
const isRunningSystemPreferences = Application('System Preferences').running() | |
Application('System Preferences').panes.byId('com.apple.preference.universalaccess').anchors.byName('Seeing_Cursor').reveal() | |
const process = Application('System Events').processes.byName('System Preferences') | |
while (process.windows.length == 0) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* MacEditorTextView | |
* Copyright (c) Thiago Holanda 2020-2021 | |
* https://twitter.com/tholanda | |
* | |
* MIT license | |
* Modified by https://github.com/cjwcommuny for TextKit 2 | |
*/ | |
import Combine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
import torch | |
from detectron2.config import get_cfg | |
from detectron2.engine import DefaultPredictor | |
from detectron2.model_zoo import model_zoo | |
from detectron2.utils.visualizer import Visualizer | |
def extract_box_features(model, image_cv, cfg): | |
device = cfg.MODEL.DEVICE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def show_opencv_image(image): | |
from matplotlib import pyplot as plt | |
image = image[:,:,::-1] | |
plt.imshow(image) | |
plt.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
^https?://(www\.)?g\.cn url 302 https://www.google.com | |
^https?://(www\.)?google\.cn url 302 https://www.google.com | |
^https?://(www\.)?google\.cn/search url 302 https://www.google.com/search |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch -y # Linux | |
conda install -c conda-forge tensorflow -y | |
conda install -c conda-forge mypy -y | |
conda install -c anaconda seaborn -y | |
conda install -c anaconda pandas -y | |
conda install -c conda-forge matplotlib -y | |
conda install -c anaconda scikit-learn -y | |
pip install opencv-contrib-python-headless # support opencl instead of using conda, headless for server | |
conda install -c anaconda jupyter -y | |
conda install -c conda-forge pytorch-lightning -y |
NewerOlder