Skip to content

Instantly share code, notes, and snippets.

@Davidtsang
Davidtsang / client.py
Created February 22, 2021 06:03 — forked from zapstar/client.py
Python Asyncio SSL client and server examples
#!/usr/bin/env python3
import asyncio
import ssl
@asyncio.coroutine
async def echo_client(data, loop):
ssl_ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
ssl_ctx.options |= ssl.OP_NO_TLSv1
@Davidtsang
Davidtsang / playground.rs
Last active October 15, 2019 15:24 — forked from rust-play/playground.rs
Code shared from the Rust Playground
#![feature(unwind_attributes)]
use std::os::unix::thread::JoinHandleExt;
use libc::pthread_cancel;
struct DropGuard;
impl Drop for DropGuard {
fn drop(&mut self) {
println!("unwinding foo");
}
}
#!/bin/bash -l
APP_PATH=/home/ubuntu/www
GIT_WORK_TREE=$APP_PATH
export GIT_WORK_TREE
export PADRINO_ENV="production"
export RACK_ENV="production"
exit_with_error(){
echo "[DEPLOY] !!!!!!!!!!!!!!!!!!!! Un error ah ocurrido !!!!!!!!!!!!!!!!!!!!!!!"
exit 1
@Davidtsang
Davidtsang / post-receive
Created August 12, 2019 16:01 — forked from yortz/post-receive
Basic git post-receive hook file to deploy a Rails app.
#!/bin/bash
APP_NAME="your-app-name-goes-here"
APP_PATH=/home/deploy/${APP_NAME}
# Production environment
export RAILS_ENV="production"
# This loads RVM into a shell session. Uncomment if you're using RVM system wide.
# [[ -s "/usr/local/lib/rvm" ]] && . "/usr/local/lib/rvm"