Skip to content

Instantly share code, notes, and snippets.

@pavelbinar
pavelbinar / index.html
Created Jun 17, 2020
Dynamically add script tag with unique src
View index.html
<script>
var now = new Date().getTime();
var newScript = document.createElement("script");
newScript.src = "<%= htmlWebpackPlugin.options.mainURL %>?t=" + now;
var target = document.getElementsByTagName("body")[0];
target.appendChild(newScript);
</script>
@pavelbinar
pavelbinar / delete-all-node-modules.md
Last active Aug 24, 2019
Delete all node_modules folders
View delete-all-node-modules.md

Delete all node_modules folders

Recursively delete all node_modules folders nested in the current folder.

find . -name "node_modules" -type d -prune -exec rm -rf '{}' +

Since many node_modules contain another node_modules it is more effective to delete just top level folder. use -maxdepth 2 to limit that depth. Adjust according to your foldr structure.

View bash_profile.sh
function color_my_prompt {
local __user_and_location="\n\[\e[32;1m\](\[\e[37;1m\]\u\[\e[32;1m\])-(\[\e[37;1m\]\w\[\e[32;1m\])"
local __git_branch='`git branch 2> /dev/null | grep -e ^* | sed -E s/^\\\\\*\ \(.+\)$/\(\\\\\1\)\ /`'
local __prompt="\n$\[\e[0m\]"
export PS1="$__user_and_location $__git_branch $__prompt "
}
color_my_prompt
@pavelbinar
pavelbinar / add-key.sh
Created May 24, 2017
Add Public SSH Key to Remote Server in a Single Command
View add-key.sh
cat ~/.ssh/id_rsa.pub | ssh user@hostname 'cat >> .ssh/authorized_keys'
View install_ubuntu_to_usb.sh
sudo fdisk -l
sudo dd if=ubuntu-17.04-beta2-desktop-amd64.iso of=/dev/sdb bs=512k
View keybase.md

Keybase proof

I hereby claim:

  • I am pavelbinar on github.
  • I am pavelbinar (https://keybase.io/pavelbinar) on keybase.
  • I have a public key ASBhSGdfFpYwMsphoCqEV1u2570Y05YkNlvjFlpb7rtGZAo

To claim this, I am signing this object:

View seting.xml
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>HEAD</AllowedMethod>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>PUT</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>DELETE</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
@pavelbinar
pavelbinar / subtitle-extract.md
Last active Jul 18, 2021 — forked from bmaeser/subtitle-extract.txt
Extract subtitles from .mkv files on Mac OS X
View subtitle-extract.md

Extract Subtitles From .mkv

These instructions shall work on Mac OS X and Linux.

Install mkvtoolnix (Mac OS X)

Installation via Homebrew:

brew install mkvtoolnix
@pavelbinar
pavelbinar / download-mp3.sh
Last active Jun 7, 2016
Download MP3 from YouTube
View download-mp3.sh
# Source: https://askubuntu.com/questions/178481/how-to-download-an-mp3-track-from-a-youtube-video
youtube-dl --extract-audio --audio-format mp3 <video URL>