Skip to content

Instantly share code, notes, and snippets.

View icyflame's full-sized avatar
💭
🌔

Siddharth Kannan icyflame

💭
🌔
View GitHub Profile
@icyflame
icyflame / vimrc
Last active January 29, 2017 05:28
the vimrc to roll with when you are thrust onto a new machine with vanilla vim
set mouse=a
set expandtab
set shiftwidth=2
set softtabstop=2
set tw=80
syntax on
filetype plugin on
@icyflame
icyflame / replace.js
Last active May 19, 2017 07:17
Replace commas according to the Indian numbering system
t = [1, 12, 123, 1234, 12345,
123456, 1234567, 12345678,
123456789, 1234567890,
12345678901, 123456789012];
function convert(x) {
return x.toString().substr()
.replace(/\B(?=\d{3}$)/g, ",")
.replace(/\B(?=(\d{2})+(?!\d),)/g, ",")
};
@icyflame
icyflame / c-cheatsheet.md
Last active July 13, 2017 06:39
A cheat sheet for some of the common c code that's often used

#define

#define iterate(i, n) for (i = 0; i < n; ++i)
#define print_int_arr(arr, i, n) for (i = 0; i < n; ++i) printf("%d, ", arr[i]);

qsort

@icyflame
icyflame / simple_format.rb
Created August 12, 2017 07:45
the ActionView::Helpers::TextHelper simple_format function for use outside Rails apps
require 'action_view'
NOTICE_ATTRIBS = 5
TOP_NOTICES = 5
# https://apidock.com/rails/v4.2.1/ActionView/Helpers/TextHelper/split_paragraphs
def split_paragraphs(text)
return [] if text.blank?
text.to_str.gsub(/\r\n?/, "\n").split(/\n\n+/).map! do |t|
@samoshkin
samoshkin / toggle_keybindings.tmux.conf
Last active January 20, 2026 00:20
tmux.conf excerpt to toggle on/off session keybindings and prefix handling
bind -T root F12 \
set prefix None \;\
set key-table off \;\
set status-style "fg=$color_status_text,bg=$color_window_off_status_bg" \;\
set window-status-current-format "#[fg=$color_window_off_status_bg,bg=$color_window_off_status_current_bg]$separator_powerline_right#[default] #I:#W# #[fg=$color_window_off_status_current_bg,bg=$color_window_off_status_bg]$separator_powerline_right#[default]" \;\
set window-status-current-style "fg=$color_dark,bold,bg=$color_window_off_status_current_bg" \;\
if -F '#{pane_in_mode}' 'send-keys -X cancel' \;\
refresh-client -S \;\
bind -T off F12 \