Skip to content

Instantly share code, notes, and snippets.

View ckaznable's full-sized avatar
🐦
Free Bird ya~

ckaznable ckaznable

🐦
Free Bird ya~
View GitHub Profile
@andelf
andelf / simple_chat.rs
Last active April 13, 2024 15:09
Simple Socket Chat Server in Rust. (TcpListener, TcpStream, SharedChan, RWArc)
extern mod sync;
// str op trait
use std::str::StrSlice;
// for tcp listen
use std::io::{TcpListener, TcpStream};
use std::io::net::ip::SocketAddr;
// for trait
use std::io::{Listener, Writer, Acceptor, Buffer};
// for spawn
@guweigang
guweigang / git_toturial
Last active June 6, 2024 00:23
git命令大全
git init # 初始化本地git仓库(创建新仓库)
git config --global user.name "xxx" # 配置用户名
git config --global user.email "xxx@xxx.com" # 配置邮件
git config --global color.ui true # git status等命令自动着色
git config --global color.status auto
git config --global color.diff auto
git config --global color.branch auto
git config --global color.interactive auto
git config --global --unset http.proxy # remove proxy configuration on git
git clone git+ssh://git@192.168.53.168/VT.git # clone远程仓库
@mcxiaoke
mcxiaoke / index.html
Created July 3, 2014 03:53 — forked from davidwkeith/index.html
detect app installed in browser
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>App Redirection</title>
</head>
<body>
<!-- iframe used for attempting to load a custom protocol -->
<iframe style="display:none" height="0" width="0" id="loader"></iframe>
@alexzaitsev
alexzaitsev / PhotosUriResolver.java
Last active January 18, 2024 21:13
Get image/video file path from New Google Photos app Uri
if (isNewGooglePhotosUri(uri)) {
String pathUri = uri.getPath();
String newUri = pathUri.substring(pathUri.indexOf("content"), pathUri.lastIndexOf("/ACTUAL"));
return getDataColumn(context, Uri.parse(newUri), null, null);
}
public static boolean isNewGooglePhotosUri(Uri uri) {
return "com.google.android.apps.photos.contentprovider".equals(uri.getAuthority());
}
@lopspower
lopspower / README.md
Last active June 10, 2024 10:41
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@xameeramir
xameeramir / default nginx configuration file
Last active June 8, 2024 12:57
The default nginx configuration file inside /etc/nginx/sites-available/default
# Author: Zameer Ansari
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
@stakira
stakira / shiftjis.txt
Created December 12, 2017 01:09
Shift-JIS Kanji Table
Shift-JIS Kanji Table
81 3f |   、 。 , . ・ : ; ? ! ゛ ゜ ´ ` ¨
81 4f | ^  ̄ _ ヽ ヾ ゝ ゞ 〃 仝 々 〆 〇 ー ― ‐ /
81 5f | \ ~ ∥ | … ‥ ‘ ’ “ ” ( ) 〔 〕 [ ]
81 6f | { } 〈 〉 《 》 「 」 『 』 【 】 + - ± ×
81 80 | ÷ = ≠ < > ≦ ≧ ∞ ∴ ♂ ♀ ° ′ ″ ℃ ¥
81 90 | $ ¢ £ % # & * @ § ☆ ★ ○ ● ◎ ◇
81 9e | ◆ □ ■ △ ▲ ▽ ▼ ※ 〒 → ← ↑ ↓ 〓
81 ae | ∈ ∋ ⊆ ⊇ ⊂ ⊃
@weihanglo
weihanglo / tokio-internals.md
Last active March 14, 2024 15:48
【譯】Tokio 內部機制:從頭理解 Rust 非同步 I/O 框架

本文譯自 [Tokio internals: Understanding Rust's asynchronous I/O framework from the bottom up][tokio-internals]。
Thanks [David Simmons][david-simmons] for this awesome article!

[Tokio][tokio] 是 Rust 的開發框架,用於開發非同步 I/O 程式(asynchronous I/O,一種事件驅動的作法,可實現比傳統同步 I/O 更好的延伸性、效能與資源利用)。可惜的是,Tokio 過於精密的抽象設計,招致難以學習的惡名。即使我讀完教程後,依然不認為自己充分內化這些抽象層,以便推斷實際發生的事情。

從前的非同步 I/O 相關開發經驗甚至阻礙我學習 Tokio。我習慣使用作業系統提供的 selection 工具(例如 Linux epoll)當作起點,再轉移至 dispatch、state machine 等等。倘若直接從 Tokio 抽象層出發,卻沒有清楚了解 epoll_wait() 在何處及如何發生,我會覺得難以連結每個概念。Tokio 與 future-driven 的方法就好像一個黑盒子。

@00001101-xt
00001101-xt / ffmpeg.md
Created November 16, 2018 08:53 — forked from protrolium/ffmpeg.md
using ffmpeg to extract audio from video files

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz:

@tkolo
tkolo / guide.md
Last active March 14, 2024 06:26
eGPU passthrough to VM for Pop!_OS/Ubuntu

Adapted from Arch wiki

Prerequisites

hardware

The extrnal monitor has to be attached to eGPU, not laptop. Otherwise this won't work.

libvirt & virt-manager

Install virt manager:

sudo apt-get install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils