Skip to content

Instantly share code, notes, and snippets.

View lonsty's full-sized avatar
😜
= ̄ω ̄=

Allen Shaw lonsty

😜
= ̄ω ̄=
View GitHub Profile
@lonsty
lonsty / m3u8-to-mp4.md
Created April 21, 2022 18:41 — forked from tzmartin/m3u8-to-mp4.md
m3u8 stream to mp4 using ffmpeg

1. Copy m3u8 link

Alt text

2. Run command

echo "Enter m3u8 link:";read link;echo "Enter output filename:";read filename;ffmpeg -i "$link" -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 $filename.mp4
@lonsty
lonsty / initial_installations_on_powershell.md
Last active April 11, 2021 09:07
Development on PowerShell

Installations on PowerShell

Git

# Prerequisites: run as Administrator
Set-ExecutionPolicy -Scope LocalMachine -ExecutionPolicy RemoteSigned -Force

# Install for current user
Install-Module posh-git -Scope CurrentUser -Force
@lonsty
lonsty / .vimrc
Last active March 2, 2021 06:33
vimrc simple template
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Maintainer:
" Amir Salihefendic — @amix3k
"
" Awesome_version:
" Get this config, nice color schemes and lots of plugins!
"
" Install the awesome version from:
"
" https://github.com/amix/vimrc
@lonsty
lonsty / rename_files.py
Created December 28, 2020 02:24
Rename files in bulk
from os import listdir, rename
from os.path import isfile, join
from sys import argv
mypath = argv[1]
onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]
for file in sorted(onlyfiles, reverse=True):
first, name = file.split(']')
index = int(first[1:])
@lonsty
lonsty / remove_bad_interpreter.py
Created December 26, 2020 13:03
Remove broken bin files
#!/usr/bin/env python3.7
# @Author: eilianxiao
# @Date: Dec 26 19:35 2020
"""删除找不到 Python 解释器的执行文件"""
import os
import subprocess
BIN_DIR = '/usr/local/bin'
found = subprocess.run(f'find {BIN_DIR} -type f', shell=True, stdout=subprocess.PIPE)
@lonsty
lonsty / git_log_formatted.md
Last active December 26, 2020 08:29
Aliases to format git log

How to

Add following aliases to ~/.zshrc:

alias glo='f() { x=${1-16}; length=`expr $x`; git log --graph --pretty=format:"%>|($length)%C(yellow)%h%Creset %C(cyan)-%Creset %<(52,trunc)%s %C(cyan)%<(12,trunc)%cr%Creset %C(magenta)%<(10,trunc)%an%Creset (%cd)%C(red)%d%Creset" --date=format:"%a %b %d %H:%M %Y"}; f'
alias glor='f() { x=${1-16}; length=`expr $x`; git log --reflog --graph --pretty=format:"%>|($length)%C(yellow)%h%Creset %C(cyan)-%Creset %<(52,trunc)%s %C(cyan)%<(12,trunc)%cr%Creset %C(magenta)%<(10,trunc)%an%Creset (%cd)%C(red)%d%Creset" --date=format:"%a %b %d %H:%M %Y"}; f'

then,

-----BEGIN RSA PRIVATE KEY-----
MIIEpQIBAAKCAQEAu4/YvagYx+P1rTdIk85VZkU7mOZXBAJZk+Kc1w2jWzoHEnXb
qmiQ8602noQ0jJmhCHThPe60x1K0F/HxQhfKCNIixlDTCvBxc98+z1XvG3vdcZoj
54gePqsA/yXNO4iiA7MJ/CR9Ml8Nn+Oy2NeAwIbvwBRtrPoeXZTL4T3EOB/7WCEH
Me+Wg1qVeZpS8K9kZIF4gxoNZvYvWawpSje0Ds2a8i90Pp3GD/O1Kg9qioNPQmVp
kcjJLuVs2X/LHyHtDCxYyuN+IoeIYgI2gUntwZ1Swf6PFg7Tr0hnupjhDXjPrXdP
DTTKDNQVIefxNfDRNz9jYeOAklIKjrWR5WbL+QIDAQABAoIBAEiLRoV0csE9hlRM
waGJeLZpqLdmv9kpH4R3bbov6DLsqreVJjUu5IGbSTjeYYTQFtyyeDwAC6PcdROd
3HZ3xQjMXe7ebAIbJYZvnleLIUQ8EFZUC/cNSsVqVqRY9pxEKIXNxdrkMhg9c4OY
CiCcmYvdpPVh8VmqE/yWBJVF0pLyAHtn772vG8dl0IxyN3QGs3T0sxcwKOuRsluU
@lonsty
lonsty / dockertags
Created October 22, 2020 00:50
List all tags for a Docker image on a remote registry
#!/bin/bash
if [ $# -lt 1 ]
then
cat << HELP
dockertags -- list all tags for a Docker image on a remote registry.
EXAMPLE:
- list all tags for ubuntu:
@lonsty
lonsty / gitmojis.json
Created June 30, 2020 11:54
gitmoji config file (add it to ~/.gitmoji/gitmojis.json)
[
{
"emoji": "🎨",
"entity": "&#x1f3a8;",
"code": ":art:",
"description": "Improving structure / format of the code.",
"name": "art"
},
{
"emoji": "⚡️",