Skip to content

Instantly share code, notes, and snippets.

View leowa's full-sized avatar

Andy Zhang leowa

View GitHub Profile
@leowa
leowa / sublime-text-3-windows-shortcuts.md
Created June 6, 2020 07:42 — forked from mrliptontea/sublime-text-3-windows-shortcuts.md
Sublime Text 3 - Useful Shortcuts (Windows)

Sublime Text 3 - Useful Shortcuts (Windows)

General

Shortcut Description
Ctrl+Shift+P command prompt
Ctrl+Alt+P switch project
Ctrl+P go to file
Ctrl+G go to line
@leowa
leowa / mbr2gpt.md
Created April 25, 2020 09:27 — forked from holms/mbr2gpt.md
Create GPT partition table and Create logical volumes

Create GPT partition table

Sorry but you HAVE to go with rescue disk.

parted /dev/sdb
(parted) mklabel gpt
(parted) mkpart primary 0GB 100%
(parted) print
@leowa
leowa / chef_local_development_workflow.md
Created March 12, 2020 22:38 — forked from smford22/chef_local_development_workflow.md
Chef Local Development Workflow - ChefDK, Vagrant, VirtualBox, Test Kitchen

Chef Local Development Workflow with ChefDK, Vagrant, VirtualBox, and Test Kitchen

Overview

The following document is intended to be a quick guide to getting you setup for doing local development with Chef. This guide was created on my MacBook, but should work fine with Linux, and Windows workstations as well.

Quick review on fundamental tenets of Chef

  • Workstation - A workstation is a computer that is configured to run various Chef command-line tools that synchronize with a chef-repo, author cookbooks, interact with the Chef server, interact with nodes, or applications like Chef Delivery
  • Node - A node is any machine—physical, virtual, cloud, network device, etc.—that is under management by Chef.
  • Chef Server- The Chef server acts as a hub for configuration data. The Chef server stores cookbooks, the policies that are applied to nodes, and metadata that describes each registered
@leowa
leowa / example-app.spec
Created January 7, 2020 09:18
golang example RPM spec template
# https://fedoraproject.org/wiki/PackagingDrafts/Go
%global commit 63fe64c471e7d76be96a625350468dfc65c06c31
%global shortcommit %(c=%{commit}; echo ${c:0:7})
Name: example-app
Version: 1.0.0
Release: 6%{?dist}
Summary: This application is an example for the golang binary RPM spec
License: ASL 2.0
URL: http://www.example-app.io
@leowa
leowa / iterm2-solarized.md
Created December 31, 2019 14:19 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@leowa
leowa / post-commit
Created December 16, 2019 23:36 — forked from leucos/post-commit
Transparent encryption/decryption with pre-commit and post-commit hooks
#!/bin/sh
#
# Post-commit hook that decrypts files containing '$ANSIBLE_VAULT'
#
# File should be .git/hooks/post-commit and executable
CRYPT_TAG='^\$ANSIBLE_VAULT'
EXIT_STATUS=0
wipe="\033[1m\033[0m"
@leowa
leowa / LICENSE
Created July 16, 2019 09:28 — forked from ourmaninamsterdam/LICENSE
Arrayzing - The JavaScript array cheatsheet
The MIT License (MIT)
Copyright (c) 2015 Justin Perry
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
@leowa
leowa / ansible-summary.md
Created November 28, 2018 21:58 — forked from andreicristianpetcu/ansible-summary.md
This is an ANSIBLE Cheat Sheet from Jon Warbrick

An Ansible summary

Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)

Configuration file

intro_configuration.html

First one found from of

import glob
import os
import re
import subprocess
root = "/Volumes/Data/baiduyun/一年级L11_L15"
def sort_by_file_index(path: str):
bn = os.path.basename(path)
@leowa
leowa / rename.py
Last active December 26, 2018 01:26
rename
#! /usr/bin/env python3
# Note and TBF: make sure the name is already sorted
# 没有 歡樂頌1】第8, 必须是 歡樂頌1】第08集
import os
import glob
import re
import argparse
parser = argparse.ArgumentParser("rename video names")