Skip to content

Instantly share code, notes, and snippets.

View wookayin's full-sized avatar
🗿
Pretty occupied

Jongwook Choi wookayin

🗿
Pretty occupied
View GitHub Profile
@wookayin
wookayin / test-iterm.sh
Created October 14, 2018 20:08
Test script for reproducing a tmux passthrough bug
#!/bin/bash
function print_osc() {
if [[ -n $TMUX ]] ; then
printf "\033Ptmux;\033\033]";
else printf "\033]"; fi
}
function print_st() {
if [[ -n $TMUX ]] ; then
@wookayin
wookayin / gym.py
Created January 25, 2019 00:41
Matplotlib animations
from matplotlib import animation
from IPython.display import display_html
from IPython.display import HTML
def display_frames_as_gif(frames):
"""
Displays a list of frames as a gif, with controls
"""
fig, ax = plt.subplots()
patch = ax.imshow(frames[0])
@wookayin
wookayin / keras-save-bug.ipynb
Created March 8, 2019 05:57
TensorFlow Keras model save bug
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
-- Make sure TS syntax tree is updated when needed by plugin (with some throttling)
-- even if the `highlight` module is not enabled.
-- See https://github.com/nvim-treesitter/nvim-treesitter/issues/2492
_G.TreesitterParse = function()
local lang = ts_parsers.ft_to_lang(vim.bo.filetype)
local parser = ts_parsers.get_parser(vim.fn.bufnr(), lang)
if parser then
parser:parse()
return true
else
@wookayin
wookayin / toggle_fstring.lua
Last active November 26, 2023 17:38
Neovim: Toggle f-string for python using treesitter
local ts_utils = require("nvim-treesitter.ts_utils")
local M = {}
-- Credit: https://www.reddit.com/r/neovim/comments/tge2ty/python_toggle_fstring_using_treesitter/
M.toggle_fstring = function()
local winnr = 0
local cursor = vim.api.nvim_win_get_cursor(winnr)
local node = ts_utils.get_node_at_cursor() ---@type TSNode?