Skip to content

Instantly share code, notes, and snippets.

View kevinyan815's full-sized avatar

Kevin Yan kevinyan815

View GitHub Profile
@kevinyan815
kevinyan815 / docker-compose.yml for laravel
Last active September 13, 2024 14:17
compose template for laravel docker project
version: '2'
services:
# The Application
app:
build:
context: ./
dockerfile: php-fpm.dockerfile
working_dir: /var/www
volumes:
- ./:/var/www
@kevinyan815
kevinyan815 / .gitlab-ci.yml
Last active January 20, 2020 10:55
A full configured gitlab ci config demo
stages:
- build
- test
- deploy
before_script:
- mkdir -p ~/.ssh
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' > /root/.ssh/id_rsa
- chmod -R 600 ~/.ssh
- echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts #make sure remote servers's ssh host keys are verified
@kevinyan815
kevinyan815 / base62_convert.php
Last active October 14, 2018 09:25
base62_convert.php
/**
* Convert a numeric string from base 10 to another base.
*
* @param $value decimal string
* @param int $b base , max is 62
* @return string
*/
function to_base($value, $b = 62)
{
$base = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
function toBaseN(num, base) {
if (num === 0) {
return '0';
}
var digits = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
var len = Math.min(digits.length, base);
var result = '';
while (num > 0) {
result = digits[num % len] + result;
num = parseInt(num / len, 10);
sudo gitlab-ci-multi-runner register
<?php
class Jwt
{
/**
* Secret Key
*
* @var
*/
private $secret = '123';
FROM php:7.1.22-fpm
# Update packages
RUN apt-get update
# Install PHP and composer dependencies
RUN apt-get install -qq git curl libmcrypt-dev libjpeg-dev libpng-dev libfreetype6-dev libbz2-dev
# Clear out the local repository of retrieved package files
RUN apt-get clean
## docker login to platform other than dockerhub
docker login [email protected] registry.cn-hangzhou.aliyuncs.com
## dockcer build
docker build -t registry.cn-hangzhou.aliyuncs.com/docker-study-lab/continuous_profiling:v0.2 .
## docker push
docker push registry.cn-hangzhou.aliyuncs.com/docker-study-lab/continuous_profiling:v0.2