Skip to content

Instantly share code, notes, and snippets.

View channprj's full-sized avatar

Park Hee Chan channprj

View GitHub Profile
@channprj
channprj / remove_danglings.sh
Last active July 9, 2020 10:22
Remove dangling images and volumes silently
#!/bin/bash
# Remove exited containers
EXITED_CONTAINERS=$(docker ps -a -f status=exited -q)
if [ ! -z "${EXITED_CONTAINERS}" ]
then
docker rm ${EXITED_CONTAINERS} &2>1
echo "Remove exited containers."
else
echo "...No exited containers."
@channprj
channprj / docker-compose.yml
Created July 6, 2020 09:13 — forked from barnybug/docker-compose.yml
Docker compose for a Docker-in-docker gitlab runners setup
# Docker-in-Docker Gitlab runners setup taken from:
# https://medium.com/@tonywooster/docker-in-docker-in-gitlab-runners-220caeb708ca
dind:
restart: always
privileged: true
volumes:
- /var/lib/docker
image: docker:17.09.0-ce-dind
command:
- --storage-driver=overlay2
@channprj
channprj / config
Created June 7, 2020 16:44
~/.ssh/config
ServerAliveInterval 120
Host *
UseKeychain yes
# Company Server
# ------------------------------------
Host company-sample-server
HostName sample.company.com
User sample_user
IdentityFile ~/.ssh/sample/id_rsa
-- Postgres 계정 생성 및 설정
CREATE ROLE sample_user WITH LOGIN PASSWORD 'sample_password';
-- Postgres 데이터베이스 생성
CREATE DATABASE sample_db WITH OWNER sample_user ENCODING 'UTF8' LC_COLLATE = 'ko_KR.UTF-8' LC_CTYPE = 'ko_KR.UTF-8';
-- sample_db 로 접속
\c sample_db;
-- DB 권한 부여
@channprj
channprj / nginx.conf
Created April 7, 2020 16:10
Nginx conf for simultaneous streaming
worker_processes 2;
# error_log logs/error.log debug;
error_log off;
events {
worker_connections 1024;
}
rtmp {
@channprj
channprj / restream.css
Last active April 9, 2024 20:30
Personal restream css
body {
background-color: rgba(0, 0, 0, 0) !important;
margin: 0px auto; overflow: hidden;
}
.restream-embed-themes-chat-container.restream-embed-themes-chat-container_default {
background: transparent !important;
}
.message-item {
@channprj
channprj / audit_mixin.py
Created March 5, 2020 12:03 — forked from techniq/audit_mixin.py
Useful SQLAlchemy Mixins
from datetime import datetime
from sqlalchemy import Column, Integer, DateTime, ForeignKey
from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declared_attr
from flask_security import current_user
class AuditMixin(object):
created_at = Column(DateTime, default=datetime.now)
updated_at = Column(DateTime, default=datetime.now, onupdate=datetime.now)
@channprj
channprj / set_ssh_key_permission.sh
Created January 10, 2020 08:25
ssh key chmod 자꾸 까먹어서 올려둠.
chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_rsa
chmod 644 ~/.ssh/id_rsa.pub
chmod 644 ~/.ssh/authorized_keys
chmod 644 ~/.ssh/known_hosts
const tzOffset = (new Date()).getTimezoneOffset() * 60000
const now = new Date(Date.now() - tzOffset).toISOString();
@channprj
channprj / repo-reset.md
Created December 18, 2019 13:24 — forked from heiswayi/repo-reset.md
GitHub - Delete commits history with git commands

First Method

Deleting the .git folder may cause problems in our git repository. If we want to delete all of our commits history, but keep the code in its current state, try this:

# Check out to a temporary branch:
git checkout --orphan TEMP_BRANCH

# Add all the files:
git add -A