Skip to content

Instantly share code, notes, and snippets.

View rockyzhang24's full-sized avatar
🎯
Focusing

Rocky Zhang rockyzhang24

🎯
Focusing
View GitHub Profile
@davidatsurge
davidatsurge / luasnip_config.lua
Last active January 15, 2023 13:22
luasnip+treesitter snippet that fills in prop names when creating new react component
local ls = require("luasnip")
local fmt = require("luasnip.extras.fmt").fmt
local s = ls.snippet
local i = ls.insert_node
local f = ls.function_node
local d = ls.dynamic_node
local sn = ls.snippet_node
local rep = require("luasnip.extras").rep
-- Get a list of the property names given an `interface_declaration`

React.js Github Repo Spammed

Background

React's official website makes a banner, which offers visitors a way to provide humanitarian aid to Ukraine.
React的官方网站做了一个横幅,为访问者提供了向乌克兰提供人道主义援助的途径。

telegram-cloud-photo-size-5-6127611897286078767-x

Then, many people went to the React.js Github repository and opened lots of spam issues with anti-US and anti-Ukrainian comments in an apparent form of digital protest. The messages are in English and Mandarin.
然后,很多人到React.js Github 仓库中开了很多带有反美国和反乌克兰 issue,进行一种数字化的抗议。这些信息是用英语和普通话写的。

@junegunn
junegunn / b.rb
Last active January 26, 2023 14:34
b - browse Chrome bookmarks with fzf
#!/usr/bin/env bash
# vim: set filetype=ruby:
# b - browse Chrome bookmarks with fzf
[ $(uname) = Darwin ] || exit 1
which fzf > /dev/null 2>&1 || brew reinstall --HEAD fzf || exit 1
/usr/bin/ruby -x "$0" |
fzf-tmux -u 30% --ansi --multi --no-hscroll --tiebreak=begin |
awk 'BEGIN { FS = "\t" } { print $2 }' |
@ofseed
ofseed / python.lua
Last active August 3, 2023 04:21
Python snippets from PyCharm
-- Same with text node, used for function nodes
local function text_same_with(args)
return args[1]
end
-- Same with text node, used for dynamic nodes
local function insert_same_with(args)
return sn(nil, {
i(1, args[1]),
})
@ofseed
ofseed / javascript.lua
Created August 3, 2023 08:54
JavaScript snippets from IntelliJ
local insert_same_with_and_append = function(args, _, _, user_arg1)
return sn(nil, {
i(1, args[1][1] .. user_arg1),
})
end
local arf
local assert = s(
{
@rbitr
rbitr / random_notes.md
Last active November 10, 2023 16:34
Confusion about using $RANDOM to generate random numbers

Random numbers in bash et al

There is a variable $RANDOM than you can read in bash or zsh to get a random number beteen 0 and 32767. Here in zsh on my (old) mac:

% echo $RANDOM
13757
% echo $RANDOM
16896
@uson1x
uson1x / hack.sh
Last active February 28, 2024 04:27 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2275613/hack.sh | sh
#
# GIT heart FZF
# -------------
is_in_git_repo() {
git rev-parse HEAD > /dev/null 2>&1
}
fzf-down() {
fzf --height 50% --min-height 20 --border --bind ctrl-/:toggle-preview "$@"
}
@dedy-purwanto
dedy-purwanto / gist:11312110
Created April 26, 2014 05:00
Bulk remove iTerm2 color schemes.
# There was a day where I have too many color schemes in iTerm2 and I want to remove them all.
# iTerm2 doesn't have "bulk remove" and it was literally painful to delete them one-by-one.
# iTerm2 save it's preference in ~/Library/Preferences/com.googlecode.iterm2.plist in a binary format
# What you need to do is basically copy that somewhere, convert to xml and remove color schemes in the xml files.
$ cd /tmp/
$ cp ~/Library/Preferences/com.googlecode.iterm2.plist .
$ plutil -convert xml1 com.googlecode.iterm2.plist
$ vi com.googlecode.iterm2.plist