Skip to content

Instantly share code, notes, and snippets.

View EMPAT94's full-sized avatar

Pritesh Tupe EMPAT94

View GitHub Profile
@EMPAT94
EMPAT94 / quick-command.vim
Last active October 27, 2020 14:11
Quicky run an external command (eg node) on current buffer and show output in temporary vertical split
" Add the following in your vim config
function! ShowNodeResult()
" command to run on current buffer
let op = system("node", bufnr())
" name of output buffer
let win = bufwinnr("__NODE_OUTPUT__")
@EMPAT94
EMPAT94 / chart.js
Last active September 22, 2020 06:14
Hasty Charts
/**
* This is a quick and dirty way to make charts in HTML.
*
* I made this for an email campaign, where embedding images was cumbersome
*/
function chart({ x_axis_values, x_axis_label, y_axis_values, y_axis_unit }) {
const x_axis = x_axis_values
.map(d => `<td style="text-align:center;vertical-align:top;font-size:8px;">${d}</td>`)
.join("\n");
@EMPAT94
EMPAT94 / emacs-mac-cmd-bindings.el
Last active May 16, 2022 07:08
All the default keybindings of cmd key in emacs!
;; I installed emacs today and wanted to bind some functions to cmd key.
;; That simple objective somehow ended with me noting down all default keybindings.
;; Sharing here so you don't have to go on this side quest like me. :)
;; For letters, if a corresponding capital letter is missing,
;; it means it calls the same function as its small case form
;;(global-set-key (kbd "s-`") 'other-frame)
;;(global-set-key (kbd "s-~") 'ns-prev-frame)
;;(global-set-key (kbd "s-1,2,3,4,5,6,7,8,9") ) ;; grouped together
@EMPAT94
EMPAT94 / dracula_theme
Created October 5, 2021 09:39
Dracula color scheme for moc (Music on Console) player
# https://github.com/dracula/dracula-theme
# Copy dracula_theme in ~/.moc/themes/ and select from theme menu (T) or set in config
# I have converted rgb to mocp format using formula : 10 * percentage (0 = 0%, 255 = 100%)
colordef black = 0 0 0
colordef red = 741 576 976 # purple
colordef green = 1000 475 776 # pink
colordef yellow = 945 980 549
colordef blue = 384 447 643 # comment
colordef cyan = 545 914 992
@EMPAT94
EMPAT94 / scrape.ts
Created October 13, 2023 06:25
Deno Scraper for Royalroad.com
/***
* DESCRIPTION:
* A small scraper to fetch chapters of a story from RoyalRoad.com.
* Give it the url of a chapter and it pulls all chapters until the end!
*
* USAGE: deno run scrape.ts <royalroad.com/fiction/x/y/chapter/x/y [text | html (default)]
*
* OUTPUT: story.[txt | html]
*/