Skip to content

Instantly share code, notes, and snippets.

View leoluyi's full-sized avatar
🎯
Focusing

Leo Lu leoluyi

🎯
Focusing
View GitHub Profile
@leoluyi
leoluyi / download-vs-code-server.sh
Created June 30, 2021 13:38 — forked from b01/download-vs-code-server.sh
Linux script to download latest VS Code Server, good for Docker (tested in Alpine).
#!/bin/sh
set -e
# You can get the latest commit SHA by looking at the latest tagged commit here: https://github.com/microsoft/vscode/releases
commit_sha="08a217c4d27a02a5bcde898fd7981bda5b49391b"
archive="vscode-server-linux-x64.tar.gz"
owner='microsoft'
repo='vscode'
# Auto-Get the latest commit sha via command line.
@leoluyi
leoluyi / py-git-cat-file.py
Created March 3, 2021 15:23 — forked from leonidessaguisagjr/py-git-cat-file.py
Studying git internals: implement `git cat-file` in Python
#!/usr/bin/env python3
"""Implementation of git cat-file in Python.
This Gist is published under the MIT License:
MIT License
Copyright (c) 2019 Leonides T. Saguisag, Jr.
Permission is hereby granted, free of charge, to any person obtaining a copy
@leoluyi
leoluyi / init.vim
Created February 5, 2021 07:45 — forked from AlanJui/init.vim
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Maintainer:
" Alan Jui : alanjui.1960@gmail.com
"
" Version:
" V 0.4.0 2019/07/01 00:14
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
@leoluyi
leoluyi / docker-compose.yml
Created May 11, 2020 13:02
GitLab Docker Compose
version: '3.2'
services:
gitlab:
image: gitlab/gitlab-ce:12.10.3-ce.0
hostname: localhost
container_name: gitlab
restart: always
volumes:
- gitlab_config:/etc/gitlab
- gitlab_logs:/var/log/gitlab
@leoluyi
leoluyi / git-feature-workflow.md
Created April 20, 2020 07:37 — forked from blackfalcon/git-feature-workflow.md
Git basics - a general workflow

Git-workflow or feature branching

When working with Git, there are two prevailing workflows are [Gitflow][gitflow] and [feature branches][feature]. IMHO, being more of a subscriber to continuous integration, I feel that the feature branch workflow is better suited, and the focus of this article.

If you are new to Git and Git-workflows, I suggest reading the [atlassian.com Git Workflow][article] article in addition to this as there is more detail there than presented here.

I admit, using Bash in the command line with the standard configuration leaves a bit to be desired when it comes to awareness of state. A tool that I suggest using follows these instructions on [setting up GIT Bash autocompletion][git-auto]. This tool will assist you to better visualize the state of a branch in regards to changes and being in sync with the remote repo.

Basic branching

@leoluyi
leoluyi / docker-cleanup-resources.md
Created December 19, 2019 06:02 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@leoluyi
leoluyi / python-logging.md
Created August 22, 2019 03:24 — forked from mariocj89/python-logging.md
Understanding logging in Python

Logging trees

Introduction

When applications are running in production, they become black boxes that need to be traced and monitored. One of the simplest, yet main, ways to do so is logging. Logging allows us - at the time we develop our software - to instruct the program to emit information while the system is running that will be useful for us and our sysadmins.

@leoluyi
leoluyi / vim-shortcuts.md
Created August 3, 2019 16:06 — forked from tuxfight3r/vim-shortcuts.md
VIM SHORTCUTS

VIM KEYBOARD SHORTCUTS

MOVEMENT

h        -   Move left
j        -   Move down
k        -   Move up
l        -   Move right
$        -   Move to end of line
0        -   Move to beginning of line (including whitespace)
@leoluyi
leoluyi / r-to-python-data-wrangling-basics.md
Created July 13, 2019 13:07 — forked from conormm/r-to-python-data-wrangling-basics.md
R to Python: Data wrangling with dplyr and pandas

R to python data wrangling snippets

The dplyr package in R makes data wrangling significantly easier. The beauty of dplyr is that, by design, the options available are limited. Specifically, a set of key verbs form the core of the package. Using these verbs you can solve a wide range of data problems effectively in a shorter timeframe. Whilse transitioning to Python I have greatly missed the ease with which I can think through and solve problems using dplyr in R. The purpose of this document is to demonstrate how to execute the key dplyr verbs when manipulating data using Python (with the pandas package).

dplyr is organised around six key verbs:

#!/usr/bin/env python
from __future__ import division
import re
# This is a naive text summarization algorithm
# Created by Shlomi Babluki
# April, 2013
class SummaryTool(object):