Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
sad, ttyS0 has been taken by other user

ttys3

💭
sad, ttyS0 has been taken by other user
View GitHub Profile
@ttys3
ttys3 / latency.markdown
Created Dec 15, 2021 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know
View latency.markdown

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs
Read 1 MB sequentially from memory ..... 250,000 ns  = 250 µs
@ttys3
ttys3 / luasocket-scm-3.rockspec
Last active Oct 19, 2021
luasocket lua 5.4.3 buffer fix err: luasocket receive() call fails on Lua 5.4.3 with "bad argument #1 to 'receive' (string expected, got light userdata)"
View luasocket-scm-3.rockspec
-- see http://lua-users.org/lists/lua-l/2021-06/msg00084.html
-- https://github.com/diegonehab/luasocket/pull/334
-- https://github.com/diegonehab/luasocket/issues/331
-- install command:
-- cd /tmp/ && curl -LO https://gist.github.com/ttys3/31dbf88ee7d708294d8ae5b0a4954424/raw/c74afc3edc1a48c0f7e1c2c9992750301bbb74ff/luasocket-scm-3.rockspec
-- luarocks install ./luasocket-scm-3.rockspec
package = "LuaSocket"
version = "scm-3"
source = {
@ttys3
ttys3 / curl_post_json.md
Created Oct 6, 2021 — forked from ungoldman/curl_post_json.md
post a JSON file with curl
View curl_post_json.md

How do you POST a JSON file with curl??

You can post a json file with curl like so:

curl -X POST -H "Content-Type: application/json" -d @FILENAME DESTINATION

so for example:

@ttys3
ttys3 / pacman.md
Last active Sep 26, 2021 — forked from tanyuan/pacman.md
Useful commands for pacman and paru
View pacman.md

Arch Linux Pacman & Paru (Feature packed AUR helper)

Pacman (Official)

Easter egg

Edit /etc/pacman.conf:

Under the # Misc options section, remove the # in front of Color and add the line ILoveCandy. Because Pac-Man loves candy.

@ttys3
ttys3 / dockergrep.sh
Created Sep 22, 2021 — forked from roylee0704/dockergrep.sh
how to grep docker log
View dockergrep.sh
docker logs nginx 2>&1 | grep "127."
# ref: http://stackoverflow.com/questions/34724980/finding-a-string-in-docker-logs-of-container
@ttys3
ttys3 / gist:3fac878dcda16010e4116adc78022a54
Created Jun 9, 2021 — forked from Victa/gist:2169221
Force Hardware Acceleration in WebKit with translate3d
View gist:3fac878dcda16010e4116adc78022a54
/* warp speed ahead */
.animClass {
-webkit-transform: translate3d(0, 0, 0);
/* more specific animation properties here */
}
/*
The use of translate3d pushes CSS animations into hardware acceleration.
Even if you're looking to do a basic 2d translation, use translate3d for more power!
If your animation is still flickering after switching to the transform above,
@ttys3
ttys3 / tohex.lua
Created Apr 19, 2021 — forked from yi/gist:01e3ab762838d567e65d
lua fromhex and tohex function
View tohex.lua
function string.fromhex(str)
return (str:gsub('..', function (cc)
return string.char(tonumber(cc, 16))
end))
end
function string.tohex(str)
return (str:gsub('.', function (c)
return string.format('%02X', string.byte(c))
end))
@ttys3
ttys3 / tproxy.sh
Created Apr 10, 2021
tproxy.sh for clash
View tproxy.sh
#!/bin/sh
# @author: ttyS3
# transparent proxy for clash
#ref to https://en.wikipedia.org/wiki/Reserved_IP_addresses
func_get_reserved_ip_addr() {
cat <<-EOF
0.0.0.0/8
10.0.0.0/8
100.64.0.0/10
@ttys3
ttys3 / colorscheme_generator.lua
Created Apr 1, 2021 — forked from shadmansaleh/colorscheme_generator.lua
Genarates colorscheme for corrent highlights in neovim
View colorscheme_generator.lua
-- This file creates a colorscheme from aleady available colorscheme
-- Author : Shadman Saleh
-- Licence : You can do whatever you want with it but do provide proper cradit
-- Uses :
-- 1. Copy this script to any &rtp/lua folder mostlikely ~/.config/nvim/lua
-- so the script can be required
-- 2. Eun :lua require('colorscheme_genarator').create('colorscheme_name', load_colorscheme)
-- colorscheme_name is the name of colorzcheme load_colorscheme is a boolean
@ttys3
ttys3 / doom.txt
Created Feb 17, 2021 — forked from hjertnes/doom.txt
Doom Emacs Cheatsheet
View doom.txt
SPC
SPC: find file
, switch buffer
. browse files
: MX
; EX
< switch buffer
` eval
u universal arg
x pop up scratch