Skip to content

Instantly share code, notes, and snippets.

@askalee
askalee / gist:c754274d8a2f8eee48cd9abe1d65f4ae
Created February 18, 2019 09:11
Google Spreadsheet Conditional format basd on "mod" on current date cell
=mod( REGEXEXTRACT(text(indirect(address(row(), column())), "yyyy-mm-dd"),"\d+\-(\d+)-\d+"),2)
  • ctrl+F4: close current file
  • ctrl+alt+left: go to previous location
  • ctrl+alt+right: go to next location
  • shift+F6: rename
  • ctrl+alt+s: setting
  • ctrl+shift+F10: run current unit test
  • ctrl+F8: set/unset breakpoint
  • ctrl+shift+enter: complete current line and go to next
  • shift+enter: go to next line
@askalee
askalee / docker_command_essentials.md
Last active December 30, 2022 00:28
docker: docker command essentials

Folder

├── service1
│   └── Dockerfile
├── service2
│   └── Dockerfile  
├── service3
│   └── Dockerfile  
├── docker-compose.yml
└── docker-compose-dev.yml  
@askalee
askalee / git_command_line_essentials.md
Last active June 22, 2018 01:49
git: command line essentials

Git alias

git config --global alias.co checkout
git config --global alias.ci commit
git config --global alias.st status
git config --global alias.br branch
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"

🍎 Note: all the following commands assume that the above aliases have been set

Get remote commits

@askalee
askalee / readme.md
Last active June 22, 2018 01:50 — forked from benstr/readme.md
Gist Markdown Cheatsheet

Heading 1 by # Heading 1

Heading 2 by ## Heading 2

Heading 3 by ### Heading 3

Heading 4 by #### Heading 4

Heading 5 by ##### Heading 5
Heading 6 by ######Heading 6

Paragraph

@askalee
askalee / git_squish.md
Last active June 21, 2018 09:26
git: squash
@askalee
askalee / gist:71be4a4ca3fa5195add85a50f027711f
Created June 21, 2018 05:54
plantuml: Group items with a hidden package for better layout
' reference: http://forum.plantuml.net/3648/invisible-packages-improve-layout-diagrams-visible-packages
@startuml
skinparam shadowing false
'skinparam backgroundColor red
skinparam package {
fontColor blue
stereotypeFontColor red
}
skinparam package<<Layout>> {
@askalee
askalee / git-move-files-in-subfolder.md
Last active June 21, 2018 05:10 — forked from ajaegers/git-move-files-in-subfolder.md
Git: move files in an subfolder keeping history

Change structure of project folder with Git

I have this structure:

 project-folder/
     .git
     wp-admin/
     wp-content/
     wp-includes/

.htaccess

@askalee
askalee / dockerenv.sh
Created June 8, 2018 08:18
Get docker container environment variables
#!/bin/bash
containerName=$1
echo "containerName: $containerName"
if [ "$containerName" == "" ]; then
echo "USAGE: $0 containerName"
echo " containerName: id or name"
exit 1
fi
docker inspect -f \
@askalee
askalee / dockerps.sh
Created June 8, 2018 07:38
A customised docker ps with some extra information. Some techniques are used: (1) use `#xxx` as inline comments (2) use sed to filter lines (3) use awk to add new columns (4) use docker ps -format to get ps info we need (5) pass a bash variable to awk with -v option (6) force awk and column to use 'tab' as seperator instead of 'space'
#!/bin/bash
# Get ip address of this machine
ipAddress="$(/sbin/ip -o -4 addr list eth0 2> /dev/null | awk '{print $4}' | cut -d/ -f1)"
if [ "$ipAddress"=="" ]; then
ipAddress="$(/sbin/ip -o -4 addr list enp0s3 2> /dev/null | awk '{print $4}' | cut -d/ -f1)"
fi
# List containers
(