Skip to content

Instantly share code, notes, and snippets.

@hmit208
hmit208 / cwl-last-used.sh
Created October 27, 2022 06:40 — forked from jsyi/cwl-last-used.sh
Use AWS CLI to query AWS CloudWatch Logs and determine the most recent entry into a Log Group
aws logs describe-log-groups | jq ".logGroups[].logGroupName" | grep -E "homeplus|mcdonalds" | xargs -n 1 -t aws logs describe-log-streams --query "logStreams[*].lastEventTimestamp" --log-group | jq "max/1000|floor" | xargs -t -n 1 date -r
# aws logs describe-log-groups | jq ".logGroups[].logGroupName"
# Get LogGroup names
# grep -E "homeplus|mcdonalds"
# (Optional) Filter LogGroup names
# xargs -n 1 -t aws logs describe-log-streams --query "logStreams[*].lastEventTimestamp" --log-group | jq "max/1000|floor"
# Get last event timestamp for each LogGroup.
@vuduongtp
vuduongtp / util.go
Created October 19, 2022 14:03
Golang - Convert Vietnamese accented characters to non-accented (Chuyển Tiếng Việt có dấu sang Tiếng Việt không dấu bằng ngôn ngữ Go/Golang)
import (
"regexp"
"strings"
)
func ConvertAccented(text string) string {
text = strings.ToLower(text)
var RegexpA = `à|á|ạ|ã|ả|ă|ắ|ằ|ẳ|ẵ|ặ|â|ấ|ầ|ẩ|ẫ|ậ`
var RegexpE = `è|ẻ|ẽ|é|ẹ|ê|ề|ể|ễ|ế|ệ`
var RegexpI = `ì|ỉ|ĩ|í|ị`
@luismts
luismts / GitCommitBestPractices.md
Last active July 23, 2024 01:05
Git Tips and Git Commit Best Practices

Git Commit Best Practices

Basic Rules

Commit Related Changes

A commit should be a wrapper for related changes. For example, fixing two different bugs should produce two separate commits. Small commits make it easier for other developers to understand the changes and roll them back if something went wrong. With tools like the staging area and the ability to stage only parts of a file, Git makes it easy to create very granular commits.

Commit Often

Committing often keeps your commits small and, again, helps you commit only related changes. Moreover, it allows you to share your code more frequently with others. That way it‘s easier for everyone to integrate changes regularly and avoid having merge conflicts. Having large commits and sharing them infrequently, in contrast, makes it hard to solve conflicts.

@bxcodec
bxcodec / _struct_to_map.go
Last active May 14, 2024 02:22
Golang Struct To Map Example By JSON tag
/*
This function will help you to convert your object from struct to map[string]interface{} based on your JSON tag in your structs.
Example how to use posted in sample_test.go file.
*/
func structToMap(item interface{}) map[string]interface{} {
res := map[string]interface{}{}
if item == nil {
return res
}
@P-A-R-U-S
P-A-R-U-S / Golang-CIDR-to-IP
Created March 16, 2018 22:55
Go: Convert CIDR to IP
// Convert CIDR to IPv4 range
func CIDRRangeToIPv4Range(cidrs []string) (ipStart string, ipEnd string, err error) {
var ip uint32 // ip address
var ipS uint32 // Start IP address range
var ipE uint32 // End IP address range
for _, CIDR := range cidrs {
@rxaviers
rxaviers / gist:7360908
Last active July 25, 2024 14:32
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue: