Skip to content

Instantly share code, notes, and snippets.

View ttys3's full-sized avatar
💭
sad, ttyS0 has been taken by other user

ttys3

💭
sad, ttyS0 has been taken by other user
View GitHub Profile
@ttys3
ttys3 / colorize-emacs.bashsource
Created February 16, 2021 17:07 — forked from algal/colorize-emacs.bashsource
Setting up truecolor (24 bit color) in emacs in the terminal, under iTerm2
# sourcing this file will define a bash functions that
# tries to run subsequent calls to emacs with 24 bit color.
#
# It sets TERM to xterm-24bit if we're running in iTerm2
# and we've created a user-local terminfo record for xterm-24bit
#
# This will cause emacs to use 24 bit color only when it will work,
# inside or outside of tmux
#
# details: https://gist.github.com/XVilka/8346728
@ttys3
ttys3 / doom.txt
Created February 17, 2021 13:20 — forked from hjertnes/doom.txt
Doom Emacs Cheatsheet
SPC
SPC: find file
, switch buffer
. browse files
: MX
; EX
< switch buffer
` eval
u universal arg
x pop up scratch
@ttys3
ttys3 / colorscheme_generator.lua
Created April 1, 2021 12:32 — forked from shadmansaleh/colorscheme_generator.lua
Genarates colorscheme for corrent highlights in neovim
-- 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 / tohex.lua
Created April 19, 2021 13:30 — forked from yi/gist:01e3ab762838d567e65d
lua fromhex and tohex function
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 / gist:3fac878dcda16010e4116adc78022a54
Created June 9, 2021 06:29 — forked from Victa/gist:2169221
Force Hardware Acceleration in WebKit with translate3d
/* 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 / dockergrep.sh
Created September 22, 2021 18:01 — forked from roylee0704/dockergrep.sh
how to grep docker log
docker logs nginx 2>&1 | grep "127."
# ref: http://stackoverflow.com/questions/34724980/finding-a-string-in-docker-logs-of-container
@ttys3
ttys3 / pacman.md
Last active September 26, 2021 14:37 — forked from tanyuan/pacman.md
Useful commands for pacman and paru

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 / curl_post_json.md
Created October 6, 2021 23:20 — forked from ungoldman/curl_post_json.md
post a JSON file with curl

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 / latency.markdown
Created December 15, 2021 12:48 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

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 / eatmem.c
Last active February 4, 2022 04:26 — forked from pfigue/eatmem.c
Eat Memory. In C. For testing memory limits.
// Compile with e.g. `gcc -o /tmp/eatmem /tmp/eatmem.c`
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#define DEFAULT_SLEEP_SECONDS 600
#define DEFAULT_ALLOC_MB 1024