Skip to content

Instantly share code, notes, and snippets.

View Wang-Cankun's full-sized avatar

Cankun Wang Wang-Cankun

View GitHub Profile
@hyperupcall
hyperupcall / settings.jsonc
Last active June 26, 2024 18:59
VSCode config to disable popular extensions' annoyances (telemetry, notifications, welcome pages, etc.)
// I'm tired of extensions that automatically:
// - show welcome pages / walkthroughs
// - show release notes
// - send telemetry
// - recommend things
//
// This disables all of that stuff.
// If you have more config, leave a comment so I can add it!!
{
@ninehills
ninehills / chatpdf-zh.ipynb
Last active April 9, 2024 06:40
ChatPDF-zh.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# 1. Start an Rstudio serssion using your R specified version
# 2. In Rstudio, install hdf5r
source(file.path(Sys.getenv("LMOD_PKG"), "init/R"))
module("load", "gnu/9.1.0 hdf5-serial/1.12.0")
install.packages("hdf5r")
# 3. If you can load hdf5r in terminal but failed in R studio, run this before loading
dyn.load('/apps/hdf5/gnu/9.1/openmpi/4.0/1.12.0/lib/libhdf5_hl.so.200')
library(hdf5r)
@Wang-Cankun
Wang-Cankun / install_r_package_local.R
Created April 14, 2020 19:39
Install R package locally on OSC
# Change /users/PAS1571/wangcankun100/R/tmp/ to your R temporary directory
tempdir <- function() "/users/PAS1571/wangcankun100/R/tmp/"
unlockBinding("tempdir", baseenv())
utils::assignInNamespace("tempdir", tempdir, ns="base", envir=baseenv())
assign("tempdir", tempdir, baseenv())
lockBinding("tempdir", baseenv())
#in order to make sure install.packages uses the custom temporary directory, one needs to do
Sys.setenv(TMPDIR="/users/PAS1571/wangcankun100/R/tmp/")
minikube stop; minikube delete &&
docker stop $(docker ps -aq) &&
rm -rf ~/.kube ~/.minikube &&
sudo rm -rf /usr/local/bin/localkube /usr/local/bin/minikube &&
launchctl stop '*kubelet*.mount' &&
launchctl stop localkube.service &&
launchctl disable localkube.service &&
sudo rm -rf /etc/kubernetes/ &&
docker system prune -af --volumes
@virolea
virolea / upload.js
Last active June 29, 2024 02:08
Tracking file upload progress using axios
upload(files) {
const config = {
onUploadProgress: function(progressEvent) {
var percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total)
console.log(percentCompleted)
}
}
let data = new FormData()
data.append('file', files[0])
@yossorion
yossorion / what-i-wish-id-known-about-equity-before-joining-a-unicorn.md
Last active June 25, 2024 07:29
What I Wish I'd Known About Equity Before Joining A Unicorn

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would

@LeCoupa
LeCoupa / redis_cheatsheet.bash
Last active June 26, 2024 15:54
Redis Cheatsheet - Basic Commands You Must Know --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
# Redis Cheatsheet
# All the commands you need to know
redis-server /path/redis.conf # start redis with the related configuration file
redis-cli # opens a redis prompt
# Strings.
@ViViDboarder
ViViDboarder / install-user-mosh.sh
Last active September 9, 2023 02:05
Mosh is great, but sometimes the remote server you're accessing doesn't have it installed or doesn't give you sudo access. This script will install mosh as a user.
#! /bin/bash
# Make a directory to hold local libs and bins
mkdir -p ~/usr/local
# Get protobuf
wget https://protobuf.googlecode.com/files/protobuf-2.5.0.tar.gz
# Extract protobuf
tar -xvzf protobuf-2.5.0.tar.gz
cd protobuf-2.5.0
@branneman
branneman / better-nodejs-require-paths.md
Last active June 29, 2024 16:00
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions