Skip to content

Instantly share code, notes, and snippets.

Avatar
🇰🇷

CHANN channprj

🇰🇷
View GitHub Profile
@channprj
channprj / remove_danglings.sh
Last active Jul 9, 2020
Remove dangling images and volumes silently
View remove_danglings.sh
#!/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 Jul 6, 2020 — forked from barnybug/docker-compose.yml
Docker compose for a Docker-in-docker gitlab runners setup
View docker-compose.yml
# 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 Jun 7, 2020
~/.ssh/config
View config
ServerAliveInterval 120
Host *
UseKeychain yes
# Company Server
# ------------------------------------
Host company-sample-server
HostName sample.company.com
User sample_user
IdentityFile ~/.ssh/sample/id_rsa
View init_postgresql_example.sql
-- 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 Apr 7, 2020
Nginx conf for simultaneous streaming
View nginx.conf
worker_processes 2;
# error_log logs/error.log debug;
error_log off;
events {
worker_connections 1024;
}
rtmp {
@channprj
channprj / restream.css
Last active Apr 5, 2020
Personal restream css
View 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 Mar 5, 2020 — forked from techniq/audit_mixin.py
Useful SQLAlchemy Mixins
View audit_mixin.py
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 Jan 10, 2020
ssh key chmod 자꾸 까먹어서 올려둠.
View set_ssh_key_permission.sh
chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_rsa
chmod 644 ~/.ssh/id_rsa.pub
chmod 644 ~/.ssh/authorized_keys
chmod 644 ~/.ssh/known_hosts
View isoStringOffset.js
const tzOffset = (new Date()).getTimezoneOffset() * 60000
const now = new Date(Date.now() - tzOffset).toISOString();
@channprj
channprj / repo-reset.md
Created Dec 18, 2019 — forked from heiswayi/repo-reset.md
GitHub - Delete commits history with git commands
View repo-reset.md

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