Skip to content

Instantly share code, notes, and snippets.

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

Allen Shaw lonsty

😜
= ̄ω ̄=
View GitHub Profile
@lonsty
lonsty / install_pillow-simd.sh
Created November 13, 2019 06:08
Install pillow-simd on Ubuntu 18.04
sudo apt-get update
# Dependency for pillow-simd on Ubuntu 18.04
sudo apt-get install -y --fix-missing \
libjpeg-turbo8-dev \
zlib1g-dev \
libtiff5-dev \
liblcms2-dev \
libfreetype6-dev \
libwebp-dev \
@lonsty
lonsty / list_files.py
Created May 27, 2020 01:51
List all files in dir and subdir
import os
from fnmatch import fnmatch
def list_files(dir_name: str, include: Iterable = None, exclude: Iterable = None) -> list:
"""
Get all files in a directory excluding ignored files.
:param dir_name: str, the root directory.
:param include: Iterable, the patterns to include.
:param exclude: Iterable, the patterns to exclude.
@lonsty
lonsty / sorin.zsh-theme.sh
Created June 8, 2020 03:21
Edited Sorin theme for zsh
# sorin.zsh-theme
# screenshot: https://i.imgur.com/aipDQ.png
if [[ "$TERM" != "dumb" ]] && [[ "$DISABLE_LS_COLORS" != "true" ]]; then
MODE_INDICATOR="%{$fg_bold[red]%}❮%{$reset_color%}%{$fg[red]%}❮❮%{$reset_color%}"
local return_status="%{$fg[red]%}%(?..⏎)%{$reset_color%}"
PROMPT='%{$fg[cyan]%}%d$(git_prompt_info) %(!.%{$fg_bold[red]%}#.%{$fg_bold[red]%}❯%{$fg_bold[blue]%}❯%{$fg_bold[green]%}❯)%{$reset_color%} '
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[blue]%}git%{$reset_color%}:%{$fg[red]%}"
@lonsty
lonsty / gnome-terminal-profiles.dconf
Created June 8, 2020 11:29
Gnome terminal profiles
[/]
default='f89e7d4e-1766-4f23-9792-51c5b2cc1131'
list=['f89e7d4e-1766-4f23-9792-51c5b2cc1131', '36a00ee5-b61e-43bd-95cb-7de3ef987a02']
[:f89e7d4e-1766-4f23-9792-51c5b2cc1131]
foreground-color='rgb(248,248,248)'
visible-name='1self'
palette=['rgb(0,0,0)', 'rgb(255,0,153)', 'rgb(0,255,153)', 'rgb(255,153,0)', 'rgb(0,153,255)', 'rgb(153,0,255)', 'rgb(153,255,0)', 'rgb(255,255,255)', 'rgb(63,63,63)', 'rgb(255,0,191)', 'rgb(0,255,191)', 'rgb(255,191,0)', 'rgb(0,191,255)', 'rgb(191,0,255)', 'rgb(191,255,0)', 'rgb(191,191,191)']
default-size-columns=132
default-size-rows=36
@lonsty
lonsty / pipis.sh
Created June 8, 2020 11:31
PIP install package and save to requirements.txt
#!/bin/bash
pip_install_save() {
package_name=$1
requirements_file=$2
if [[ -z $requirements_file ]]
then
requirements_file='./requirements.txt'
fi
pip install && pip freeze | grep -i $package_name >> $requirements_file
@lonsty
lonsty / config
Created June 11, 2020 00:49
SSH proxy configuration with authentication
# FILE: ~/.ssh/config
Host 39.100.111.202 124.156.119.138 121.36.50.79 49.235.81.110 cn.lonsty.me github.com git.lonsty.me hk.lonsty.me gitlab.com gitee.com bitbucket.org git.dev.tencent.com e.coding.net git.code.sf.net shell.sourceforge.net 50.19.103.36
# ProxyCommand nc -X connect -x 10.57.197.116:50030 %h %p
# ProxyCommand nc -X connect -x 10.168.17.70:808 %h %p
ProxyCommand sshpass -p Foxconniisd nc -X connect -x 10.60.136.225:808 -Piisd %h %p
ServerAliveInterval 10
StrictHostKeyChecking no
@lonsty
lonsty / gitmojis.json
Created June 30, 2020 11:54
gitmoji config file (add it to ~/.gitmoji/gitmojis.json)
[
{
"emoji": "🎨",
"entity": "🎨",
"code": ":art:",
"description": "Improving structure / format of the code.",
"name": "art"
},
{
"emoji": "⚡️",
@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:
-----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