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 / install_requirements.R
Last active May 13, 2020 10:22 — forked from cannin/installPackages.R
Install/update necessary packages from CRAN, Bioconductor, GitHub, or local source given a vector of strings with names of packages or file paths
#' Install/update necessary packages from CRAN, GitHub
#'
#' @param packages a vector of strings with names of packages from CRAN, Bioconductor, GitHub
#' @param file a file with packages; overrides packages parameter
#' @param update_packages whether to update existing packages (Default: FALSE)
#' @param repos the CRAN repository to use
#' @param dry_run whether to test for missing packages (Default: FALSE)
#'
#' @example
#' \dontrun {
@leoluyi
leoluyi / pagination-collection.liquid
Created April 9, 2019 14:39 — forked from Phlow/pagination-collection.liquid
If you need pagination for a collection in a Jekyll theme, you can use the following Liquid logic which works also on Github pages
{% comment %}
#
# I modified the original code from http://anjesh.github.io/2015/01/25/collection-pagination-working-github-pages/
#
# Make a collection in _config.yml and create the folder _your_collection in your root.
#
# collections:
# your_collection:
# output: true
# permalink: /:collection/:title/
@leoluyi
leoluyi / docker-compose-cheatsheet.md
Last active February 22, 2019 06:32 — forked from buonzz/docker-compose-cheatsheet.sh
docker-compose cheatsheet

docker-compose cheatsheet

docker-compose up # Starts multiple containers from docker-compose.yaml in same dir
docker-compose exec <service> <cmd> # Execute command in running container
docker-compose down # Removes associated containers, networks and volumes

$ docker-compose up -d         # start containers in background
@leoluyi
leoluyi / _Nvim-R-Tmux.md
Created January 10, 2019 13:19 — forked from tgirke/_Nvim-R-Tmux.md
Nvim-R-Tmux: An Integrated Working Environment for R
@leoluyi
leoluyi / Readme.md
Created December 19, 2018 10:08 — forked from pjkelly/Readme.md
GitHub Flow: Keeping Feature Branches Up-to-Date & Merging Work Back Into Master

Keeping Feature Branches Up-to-Date & Merging Work Back Into Master

The basic flow is this:

  • When you want to update a feature branch you're working on, rebase on to it.
  • When you're ready to integrate the work you've been doing into the master branch, merge it.

Detailed Step-by-Step

Given the name of your feature branch is registration-page:

@leoluyi
leoluyi / db_tools.py
Created November 13, 2018 04:02 — forked from riffm/db_tools.py
Gentle `drop tables` using sqlalchemy
# -*- coding: utf-8 -*-
from sqlalchemy import create_engine
from sqlalchemy.types import SchemaType
from sqlalchemy.engine import reflection
from sqlalchemy.schema import (
MetaData,
Table,
DropTable,
ForeignKeyConstraint,
@leoluyi
leoluyi / apppier_upload.py
Last active November 12, 2018 06:56
Upload eland data for large files
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import requests
import json
import time
import csv
__version__ = "1.0"
#!/usr/bin/env bash
################################################################
# Script_Name : install-xrdp-1.9.2.sh
# Description : Perform an automated custom installation of xrdp
# on ubuntu 16.04.4
# Date : March 2018
# written by : Griffon
# Web Site :http://www.c-nergy.be - http://www.c-nergy.be/blog
# Version : 1.9.2
@echo off
:: http://weblogs.asp.net/jgalloway/archive/2006/11/20/top-10-dos-batch-tips-yes-dos-batch.aspx
echo %%~1 = %~1
echo %%~f1 = %~f1
echo %%~d1 = %~d1
echo %%~p1 = %~p1
echo %%~n1 = %~n1
echo %%~x1 = %~x1
echo %%~s1 = %~s1
echo %%~a1 = %~a1
@leoluyi
leoluyi / sublime-text-macos-context-menu.md
Created October 20, 2018 16:08 — forked from idleberg/sublime-text-macos-context-menu.md
“Open in Sublime Text” in macOS context-menu

Open in Sublime Text

  • Open Automator
  • Create a new Service
  • Set “Service receives selected” to files or folders in any application
  • Add a Run Shell Script action
  • Set the script action to /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl -n "$@"
  • Set “Pass input” to as arguments
  • Save as Open in Sublime Text