Skip to content

Instantly share code, notes, and snippets.

View robbinhan's full-sized avatar
🏠
Working from home

robbin han robbinhan

🏠
Working from home
View GitHub Profile
@vizsumit
vizsumit / LoraConfig.json
Last active June 12, 2024 12:44
settings for Kohya_ss LoRA Training
{
"LoRA_type": "Standard",
"adaptive_noise_scale": 0,
"additional_parameters": "",
"block_alphas": "",
"block_dims": "",
"block_lr_zero_threshold": "",
"bucket_no_upscale": true,
"bucket_reso_steps": 64,
"cache_latents": true,
@MihailCosmin
MihailCosmin / cuda_11.8_installation_on_Ubuntu_22.04
Last active June 13, 2024 18:12 — forked from primus852/cuda_11.7_installation_on_Ubuntu_22.04
Instructions for CUDA v11.8 and cuDNN 8.7 installation on Ubuntu 22.04 for PyTorch 2.0.0
#!/bin/bash
### steps ####
# verify the system has a cuda-capable gpu
# download and install the nvidia cuda toolkit and cudnn
# setup environmental variables
# verify the installation
###
### to verify your gpu is cuda enable check
@ThaddeusJiang
ThaddeusJiang / interview report template (tech)
Last active November 22, 2022 16:44
Interview report template (tech)
Total: 1~5
下面各项得分的平均分
Experience: 1~5
过往项目的客户群(ToB or ToC)、项目规模、项目中担当的角色、是否有突出贡献等等
Skill: 1~5
开发基础、设计能力、能否攻克中大型开发难题,能否担当 full stack 任务等等
@robbinhan
robbinhan / how-to-delete-lines-containing-a-given-string.md
Created February 1, 2017 07:50 — forked from nepsilon/how-to-delete-lines-containing-a-given-string.md
How to delete lines containing a given string? — First published in fullweb.io issue #85

How to delete lines containing a given string?

Just like last week, where we wanted to replace a string, we can use sed for this task:

sed '/pouet/d' file.txt

This will output file.txt on stdout without the lines containing pouet.

@atoponce
atoponce / gist:07d8d4c833873be2f68c34f9afc5a78a
Last active June 1, 2024 04:56 — forked from tqbf/gist:be58d2d39690c3b366ad
Cryptographic Best Practices

Cryptographic Best Practices

Putting cryptographic primitives together is a lot like putting a jigsaw puzzle together, where all the pieces are cut exactly the same way, but there is only one correct solution. Thankfully, there are some projects out there that are working hard to make sure developers are getting it right.

The following advice comes from years of research from leading security researchers, developers, and cryptographers. This Gist was [forked from Thomas Ptacek's Gist][1] to be more readable. Additions have been added from

  • TUN和TAP是virutal-network kernel devices.
  • TUN(network TUNnel) 模拟layer 3(network layer)设备, IP packets, 用于routing.
  • TAP(network tap) 模拟layer 2(link layer)设备, Ethernet frames, 用于创建 network bridge.
  • tun/tap驱动程序是Linux平台虚拟网卡驱动程序, 驱动加载后会建立网络接口tun0, 与其他网卡驱动不同的是, tun驱动并不会把到达的数据包发送出去, 而是会暂时存储于队列之中, 用户态进程可以通过read, write读写网络数据包, 实质上此驱动是一种把网络数据包直接定向至用户态进程的一种方式. 用户态进程充当网络的角色, 通过read接受网卡数据包, write发送数据包给网卡.

tun/tap驱动程序实现了虚拟网卡的功能, tun表示虚拟的是点对点设备, tap表示虚拟的是以太网设备, 这两种设备针对网络包实施不同的封装.

经过操作系统通过TUN/TAP device发出去的包, 被deliver到一个用户空间程序, 这个用户空间程序把他自己附属于到这个device上. 一个用户空间程序也可以发送包给一个TUN/TAP device. 在这种情况, TUN/TAP device deliver(或inject)这些包到操作系统的network stack, 因此, 仿真他们的接收来自一个外部源.

利用tun/tap驱动, 可以将tcp/ip协议栈处理好的网络分包传给任何一个使用tun/tap驱动的进程, 由进程重新处理后再发到物理链路中.

@hgfischer
hgfischer / benchmark+go+nginx.md
Last active April 11, 2024 22:09
Benchmarking Nginx with Go

Benchmarking Nginx with Go

There are a lot of ways to serve a Go HTTP application. The best choices depend on each use case. Currently nginx looks to be the standard web server for every new project even though there are other great web servers as well. However, how much is the overhead of serving a Go application behind an nginx server? Do we need some nginx features (vhosts, load balancing, cache, etc) or can you serve directly from Go? If you need nginx, what is the fastest connection mechanism? This are the kind of questions I'm intended to answer here. The purpose of this benchmark is not to tell that Go is faster or slower than nginx. That would be stupid.

So, these are the different settings we are going to compare:

  • Go HTTP standalone (as the control group)
  • Nginx proxy to Go HTTP
  • Nginx fastcgi to Go TCP FastCGI
  • Nginx fastcgi to Go Unix Socket FastCGI
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active June 13, 2024 10:59
A badass list of frontend development resources I collected over time.