Skip to content

Instantly share code, notes, and snippets.

View dipsywong98's full-sized avatar
👶
Teletubbies say hello

Dipsy Wong dipsywong98

👶
Teletubbies say hello
View GitHub Profile
@dipsywong98
dipsywong98 / pytorch.md
Created May 9, 2023 16:20
Troubleshoot why installed nvidia driver and cuda already, why PyTorch still cant use cuda

Troubleshoot why installed nvidia driver and cuda already, why PyTorch still cant use cuda

My environment: Ubuntu 22.04 LTS on Win11 WSL 2, RTX 2060 on Laptop

I have checked nvidia and cuda already is latest by running below command to see installed version, and comparing the result of googling latest nvdia driver and cuda version online

nvidia-smi

How to test websocket in rust Actix framework

It is taking a lot of time to research how to properly test websocket in Actix framework, because their docs, googling and ChatGPT didnt give me answers that works for me. I am not sure is it my googling skill problem or not many people are not asking the same problem as what i did, anyway i found the solution inside actix's source code. I didnt find that in actix's documentation page so i think i better write my findings down and hopefully this can help others who are facing the same problem. First let me share what I have found and what are their problem. Please correct me if my findings are not accurate as I am just a beginner to Rust and Actix.

  1. Some are like spinning up a separate server and separete process to test against the server, this will work but not as clean, breakpointing at the server doesnt imply breakpointing in the testing process, there might be side effect for example timeout logic in test etc. And need spin up the server before running
@dipsywong98
dipsywong98 / inject.js
Created August 6, 2022 10:19
Inject github page link tampermonkey script
// ==UserScript==
// @name Inject github page link
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author Dipsy Wong
// @match https://github.com/*
// @grant none
// ==/UserScript==
image: node:latest
services:
- redis:latest
variables:
REDIS_URL: redis://redis:6379
REDIS_PORT: 6379
stages:
@dipsywong98
dipsywong98 / Tentoban-agreement.md
Last active February 7, 2021 16:12
Tentoban End User Agreement and Privacy Policy

Tentoban - Tentoban End User Agreement and Privacy Policy

Define "Tentoban" as the Tentoban game on google play, light-up.gamelet.online dipsy.me/light-up. Define "you" as user of Tentoban. Define "we" as owner of Tentoban

What information we collect and their usage

You may choose to sign up by simply providing an username and password, so that we can keeptrack your progress, and publish your custom level to let other players play.

placeholder
@dipsywong98
dipsywong98 / ThreeViewer.tsx
Created August 31, 2020 11:51
React Component of three.js
import React, { useCallback, useEffect, useRef, useState } from 'react'
import * as THREE from 'three'
export const ThreeViewer = () => {
const root = useRef<HTMLDivElement>(null)
const [{ renderer, camera }, set3] = useState<{ renderer?: THREE.Renderer, camera?: THREE.PerspectiveCamera }>({})
const resize = useCallback((): void => {
const div = root.current
if (div !== null && renderer !== undefined && camera !== undefined) {
camera.aspect = div.clientWidth / div.clientHeight
@dipsywong98
dipsywong98 / auto-love.js
Created March 27, 2020 12:12
FB 直播全自動俾心
window.setInterval(() => document.querySelector('[aria-label="勁正"]').click(), 1000)

KDE screenshot with copy

  1. install xclip
sudo apt-get install xclip
  1. create a new shortcut