Skip to content

Instantly share code, notes, and snippets.

# -*- coding: UTF-8 -*-
import signal
import sys
import traceback
import time
import logging
import json
import channels.layers
from asgiref.sync import async_to_sync
from channels.db import database_sync_to_async
@ArthurPai
ArthurPai / Deploy-TeamCityBuildToOctopus.ps1
Created November 8, 2019 04:19 — forked from ChaseFlorell/Deploy-TeamCityBuildToOctopus.ps1
a script for TeamCity to get git commits and pass them along to Octopus Deploy
# credit for getting me going in the right direction
# http://blogs.lessthandot.com/index.php/uncategorized/access-git-commits-during-a-teamcity-build-using-powershell/
# these properties should be entered into your configuration parameters section
$project = "%Octopus.Project%"
$deployTo = "%Octopus.DefaultEnvironment%"
$buildVersion = "%BuildVersion%"
$octopusApiKey = "%Octopus.BuildDeployBot.APIKey%"
$octopusServer = "%Octopus.Server.Url%"
@ArthurPai
ArthurPai / Flexible Dockerized Phoenix Deployments.md
Created March 2, 2018 10:38 — forked from jswny/Flexible Dockerized Phoenix Deployments.md
A guide to building and running zero-dependency Phoenix (Elixir) deployments with Docker. Works with Phoenix 1.2 and 1.3.

Prelude

I. Preface and Motivation

This guide was written because I don't particularly enjoy deploying Phoenix (or Elixir for that matter) applications. It's not easy. Primarily, I don't have a lot of money to spend on a nice, fancy VPS so compiling my Phoenix apps on my VPS often isn't an option. For that, we have Distillery releases. However, that requires me to either have a separate server for staging to use as a build server, or to keep a particular version of Erlang installed on my VPS, neither of which sound like great options to me and they all have the possibilities of version mismatches with ERTS. In addition to all this, theres a whole lot of configuration which needs to be done to setup a Phoenix app for deployment, and it's hard to remember.

For that reason, I wanted to use Docker so that all of my deployments would be automated and reproducable. In addition, Docker would allow me to have reproducable builds for my releases. I could build my releases on any machine that I wanted in a contai

@ArthurPai
ArthurPai / install-redis.sh
Created February 7, 2018 02:13 — forked from khelll/install-redis.sh
Installing Redis on Amazon Linux
#!/bin/bash
###############################################
# To use:
# chmod +x install-redis.sh
# ./install-redis.sh
###############################################
version=3.2.0
echo "*****************************************"
echo " 1. Prerequisites: Install updates, set time zones, install GCC and make"
@ArthurPai
ArthurPai / getSchema.graphql
Created September 25, 2017 15:53 — forked from expede/getSchema.graphql
Get complete GraphQL schema
query IntrospectionQuery {
__schema {
queryType { name }
mutationType { name }
types {
...FullType
}
directives {
name
description
# 规则配置仅供参考,适用于 Surge Mac (1.0.7) 及其后续版本;
# 包含 Proxy Group、URL Rewrite 特性;
# 包含 Reject 规则,用于拦截广告、行为分析、数据统计;
# 屏蔽 Hao123、百度搜索,放行百度地图、百度外卖、百度音乐、百度云盘、百度百科。
# Surge for Mac 简明指南 http://bit.ly/1TATRaG
[General]
# warning, notify, info, verbose
skip-proxy = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, 100.64.0.0/10, localhost, *.local
bypass-tun = 0.0.0.0/8, 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12
loglevel = notify
#!/bin/bash
# Copyright 2015 The Kubernetes Authors All rights reserved.
#
# 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
#
@ArthurPai
ArthurPai / kubernates_ubuntu_download-release.sh
Last active January 8, 2019 19:00
Kubernetes下載script
#!/bin/bash
# Copyright 2015 The Kubernetes Authors All rights reserved.
#
# 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
#
http://stackoverflow.com/questions/3333665/rank-function-in-mysql
If you want to rank just one person you can do the following:
```
SELECT COUNT(Age) + 1
FROM PERSON
WHERE(Age < age_to_rank)
```
#
# Wide-open CORS config for nginx
#
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
#