Skip to content

Instantly share code, notes, and snippets.

@taoyuan
taoyuan / npm-using-https-for-git.sh
Last active June 25, 2024 16:25
Force git to use https:// instead of git://
# npm using https for git
git config --global url."https://github.com/".insteadOf git@github.com:
git config --global url."https://".insteadOf git://
# npm using git for https
git config --global url."git@github.com:".insteadOf https://github.com/
git config --global url."git://".insteadOf https://
@w-vi
w-vi / utf-8-truncate.c
Last active May 17, 2019 00:04
Truncate correctly UTF-8 encoded string
#include <stdio.h>
#include <string.h>
/* UTF-8 character might be encoded in up to 4 bytes according to RFC
* 3629 so to truncate it correctly care needs to be taken for such
* characters. ASCII character are in single byte using 7 bits (max is
* 127) so any multi-byte character has first byte higher then
* 127. Because first byte in multi-byte sequence is encoding how many
* bytes this sequence has we can easily check for it looking for the
* first byte in sequence and see how many bytes more to truncate.
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active June 29, 2024 08:12
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@spicycode
spicycode / tmux.conf
Created September 20, 2011 16:43
The best and greatest tmux.conf ever
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000