Skip to content

Instantly share code, notes, and snippets.

View yunlingz's full-sized avatar

Yunling Zhu yunlingz

View GitHub Profile
@castwide
castwide / rails.rb
Last active October 24, 2024 16:26
Enhance Rails Intellisense in Solargraph
# The following comments fill some of the gaps in Solargraph's understanding of
# Rails apps. Since they're all in YARD, they get mapped in Solargraph but
# ignored at runtime.
#
# You can put this file anywhere in the project, as long as it gets included in
# the workspace maps. It's recommended that you keep it in a standalone file
# instead of pasting it into an existing one.
#
# @!parse
# class ActionController::Base
@t-vi
t-vi / __init__.pyi
Last active July 13, 2023 09:11
PyTorch Type Hints work in progress (put into python3.x/dist-packages/torch/ directory to try)
from typing import List, Tuple, Optional, Union, Any, ContextManager, Callable, overload
import builtins
import math
import pickle
class dtype: ...
_dtype = dtype
@dimkouv
dimkouv / arch-wlan-to-eth.sh
Created August 28, 2017 13:42
Share wifi over ethenet | arch linux
# PC2 <---eth cable--- PC1 <-- ((( wifi )))
# connect as root on PC1
su
# install networkmanager
pacman -S networkmanager
# enable networkmanager and start it
systemctl start NetworkManager
@gouravd
gouravd / rotateYUVImage.java
Created September 26, 2015 20:40
Rotate YUVimage
public static byte[] rotateYUV420Degree90(byte[] data, int imageWidth, int imageHeight) {
byte[] yuv = new byte[imageWidth * imageHeight * 3 / 2];
// Rotate the Y luma
int i = 0;
for (int x = 0; x < imageWidth; x++) {
for (int y = imageHeight - 1; y >= 0; y--) {
yuv[i] = data[y * imageWidth + x];
i++;
}
}
@cheuerde
cheuerde / glibc_install.sh
Last active April 24, 2024 08:06
Install GNU libc version parallel to existing system
# Claas Heuer, August 2015
#
# urls:
# http://stackoverflow.com/questions/847179/multiple-glibc-libraries-on-a-single-host
# http://www.gnu.org/software/libc/download.html
cd $HOME
mkdir glibc_update
cd glibc_update
@staltz
staltz / introrx.md
Last active December 1, 2025 11:31
The introduction to Reactive Programming you've been missing
@liukai
liukai / migrate_rocksdb
Last active November 14, 2022 11:37
Migrate RocksDB database with different options
rocksdb::Status CopyDB(const std::string& source_db_name,
const Options& source_db_options,
const std::string& destination_db_name,
const Options& destination_db_options) {
rocksdb::Status s;
// Create the source/destination DBs
rocksdb::DB* source_db = nullptr;
auto sanitized_source_db_options = source_db_options;
sanitized_source_db_options.create_if_missing = false;
@yoggy
yoggy / uuid_test.c
Created January 8, 2013 11:19
libuuid sample program
//
// libuuid sample program
//
// library install for debian
// $ sudo apt-get install uuid-dev
//
// compile
// $ gcc uuid_test.c -luuid -o uuid_test
//
#include <stdio.h>

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@johan
johan / laughing-man.svg
Created July 6, 2011 04:56
The Laughing Man (Ghost in the Shell), 1000 byte SVG :-)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.