Skip to content

Instantly share code, notes, and snippets.

View craftslab's full-sized avatar
:octocat:
Focusing

Jia craftslab

:octocat:
Focusing
View GitHub Profile
@craftslab
craftslab / main.go
Last active May 3, 2021 03:20
hello gin
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
@craftslab
craftslab / App.vue
Last active July 29, 2021 01:27
hello vue
<template>
<div id="app">
<VueList msg="Hello Vue"/>
</div>
</template>
<script>
import VueList from './components/VueList.vue'
export default {
@craftslab
craftslab / nginx.conf
Last active November 1, 2020 06:02
nginx config
upstream backend {
server 127.0.0.1:3000;
}
server {
listen 80;
server_name localhost;
error_log /var/log/nginx/debug.log debug;
location / {
proxy_pass http://backend;
@craftslab
craftslab / README.md
Last active August 8, 2021 15:37
etcd client

Requirement

  • etcd >= 3.5.0

Run

# Start a local etcd server
@craftslab
craftslab / procexp.sh
Last active December 10, 2020 04:29
process explorer
#!/usr/bin/env bash
plist="\
proc1,\
proc2"
send_kill=false
version="v1.0.0"
@craftslab
craftslab / README.md
Last active January 29, 2022 12:21
python grpc

Install

pip install grpcio
pip install grpcio-tools

Build

@craftslab
craftslab / Cargo.toml
Last active April 2, 2022 03:29
hello rust
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[package]
name = "hello-rust"
version = "0.0.1"
edition = "2021"
rust-version = "1.59"
authors = ["Jia Jia <angersax@sina.com>"]
description = "Hello Rust"
repository = "https://github.com/craftslab/hello-rust"
@craftslab
craftslab / README.md
Last active February 4, 2022 03:11
bcompare docker

Build

FROM ubuntu:18.04

RUN apt update -y && \
    apt install -y build-essential && \
    apt install -y libc6-dev && \
    apt install -y libglib2.0-dev && \
    apt install -y poppler-utils && \
@craftslab
craftslab / README.md
Last active May 4, 2021 01:11
gorm postgres

Install

# Docker
# https://gist.github.com/craftslab/94ec9617aff0bbf022ae388eb1b3287b

# Ubuntu
# https://www.postgresql.org/download/linux/ubuntu/
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
@craftslab
craftslab / clean.sh
Last active November 16, 2021 03:04
ubuntu clean
#!/bin/bash
rm -rf $HOME/.cache/thumbnails/*
sudo apt-get autoremove --purge
sudo apt-get clean
sudo journalctl --disk-usage
sudo journalctl --vacuum-time=1s
sudo journalctl --disk-usage