Skip to content

Instantly share code, notes, and snippets.

@darkchoco
darkchoco / django_deploy.md
Created April 15, 2021 08:42 — forked from bradtraversy/django_deploy.md
Django Deployment - Digital Ocean

Django Deployment to Ubuntu 18.04

In this guide I will go through all the steps to create a VPS, secure it and deploy a Django application. This is a summarized document from this digital ocean doc

Any commands with "$" at the beginning run on your local machine and any "#" run when logged into the server

Create A Digital Ocean Droplet

Use this link and get $10 free. Just select the $5 plan unless this a production app.

@darkchoco
darkchoco / ipassign
Created April 4, 2021 10:42 — forked from jsianes/ipassign
Script to assign Public IP from Elastic IP pool for instances hosted in AWS. 'ec2-utils' and AWS CLI packages required. Instance role or access keys need to allow at least next EC2 actions: describe-addresses, associate-address and disassociate-address. Shell script is designed to be integrated with instance start-up
#!/bin/bash
# chkconfig: 2345 99 10
# description: Set Public IP from ElasticIP pool during instance startup
# processname: ipassign
# Provides: ipassign
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: Set Public IP from ElasticIP pool during instance startup
@darkchoco
darkchoco / reassign_eip.sh
Created March 12, 2021 15:13
Reassigning EIP on the EC2 instance to another. Since Name value is used as argument, EC2 instance must have the Name tag.
#!/bin/bash
if [[ $# -ne 2 ]]; then
echo "Usage: $(basename "$0") ec2_name_with_eip target_ec2_name"
exit
fi
#SRC_EC2_ID=`aws ec2 describe-instances --filters 'Name=tag:Name,Values=$1' --query 'Reservations[*].Instances[*].InstanceId' --output text`
FILTER="Name=tag:Name,Values=$1"
@darkchoco
darkchoco / ansible_conditionals_examples.yaml
Created March 1, 2021 20:53 — forked from marcusphi/ansible_conditionals_examples.yaml
Ansible 1.3 Conditional Execution -- Very complete example with comments -- I find the conditional expressions to be ridiculously hard to get right in Ansible. I don't have a good model of what's going on under the surface so I often get it wrong. What makes it even harder is that there has been at least three different variants over the course …
---
# This has been tested with ansible 1.3 with these commands:
# ansible-playbook -i hosts ansible_conditionals_examples.yaml --extra-vars="hosts=myhosts isFirstRun=false"
# ansible-playbook -i hosts ansible_conditionals_examples.yaml --extra-vars="hosts=myhosts isFirstRun=true"
# ansible-playbook -i hosts ansible_conditionals_examples.yaml --extra-vars="hosts=myhosts"
# NB: The type of the variable is crucial!
- name: Ansible Conditionals Examples
hosts: $hosts
vars_files:
@darkchoco
darkchoco / gist:5ed0566fb1825e56ad83103c81a68a75
Created February 15, 2019 11:22
Sublime Text 3 Key Bindings
[
{ "keys": ["alt+m"],
"command": "markdown_preview",
"args": {
"target": "browser",
"parser": "markdown"
}
},
{ "keys": ["ctrl+0"],
"command": "reset_font_size"
@darkchoco
darkchoco / confluence-space.css
Created October 12, 2018 14:48
Confluence Space Stylesheet
body {
font-size: 14px;
}
.wiki-content,
.wiki-content p,
.wiki-content table,
.wiki-content tr,
.wiki-content td,
.wiki-content th,
.wiki-content ol,
@darkchoco
darkchoco / intellij-node-gitignore-file
Created May 22, 2018 11:44 — forked from jhines2k7/intellij-node-gitignore-file
Git ignore file for Intellij projects that use node.js
# Created by https://www.gitignore.io
### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm
*.iml
## Directory-based project format:
.idea/
# if you remove the above rule, at least ignore the following:
@darkchoco
darkchoco / s3-file-sharing.md
Created October 24, 2017 14:30 — forked from pjkelly/s3-file-sharing.md
Setting up an Amazon S3 bucket to share files.

Setting up an Amazon S3 bucket to share files

  1. Sign into your AWS console: https://console.aws.amazon.com/console/home
  2. Click on “S3”.
  3. Click “Create Bucket” and enter a Bucket Name using only alphanumeric characters and no spaces. We recommend prefixing it with your organization’s name, so something like “myorganization-downloads” works well. No other customization is necessary, so then click “Create” to complete the creation process.
  4. Choose the bucket you just created from the list of buckets to navigate into it.
  5. Once inside the folder, click “Upload” and upload all the files you want there.
  6. After your files are done uploading, select them by clicking the square to their left and then choose “Actions” -> “Make Public”. This will make the files publicly accessible.
  7. To get the public URL of a file, select the file and then click the Properties tab (in the top right of the window). The Link attribute contains the publicly accessible URL of the file.

[공통] 마크다운 markdown 작성법

1. 마크다운에 관하여

1.1. 마크다운이란?

**Markdown**은 텍스트 기반의 마크업언어로 2004년 존그루버에 의해 만들어졌으며 쉽게 쓰고 읽을 수 있으며 HTML로 변환이 가능하다. 특수기호와 문자를 이용한 매우 간단한 구조의 문법을 사용하여 웹에서도 보다 빠르게 컨텐츠를 작성하고 보다 직관적으로 인식할 수 있다. 마크다운이 최근 각광받기 시작한 이유는 깃헙(https://github.com) 덕분이다. 깃헙의 저장소Repository에 관한 정보를 기록하는 README.md는 깃헙을 사용하는 사람이라면 누구나 가장 먼저 접하게 되는 마크다운 문서였다. 마크다운을 통해서 설치방법, 소스코드 설명, 이슈 등을 간단하게 기록하고 가독성을 높일 수 있다는 강점이 부각되면서 점점 여러 곳으로 퍼져가게 된다.

1.2. 마크다운의 장-단점

1.2.1. 장점

@darkchoco
darkchoco / .kitchen.yml
Created March 13, 2017 15:39
.kitchen.yml - needs to be updated if necessary
---
driver:
name: ec2
aws_ssh_key_id: demo-key
security_group_ids: ["sg-9e7xxxxx"]
region: eu-west-1
availability_zone: c
require_chef_omnibus: true
subnet_id: subnet-8xxxxxxx
instance_type: t2.micro