Skip to content

Instantly share code, notes, and snippets.

View zz's full-sized avatar
💭
I may be slow to respond.

ZZ zz

💭
I may be slow to respond.
  • Japan
View GitHub Profile
@zz
zz / AzureNSG.ps1
Last active August 29, 2015 14:20 — forked from andreaswasita/AzureNSG.ps1
#Create a Network Security Group
New-AzureNetworkSecurityGroup -Name "DMZ_NSG" -Location Southeast Asia -Label "DMZ NSG SEVNET"
#Add, Update Rules to a NSG
Get-AzureNetworkSecurityGroup -Name "DMZ_NSG" | Set-AzureNetworkSecurityRule -Name RDPInternet-DMZ -Type Inbound -Priority 347 -Action Allow -SourceAddressPrefix 'INTERNET' -SourcePortRange '63389' -DestinationAddressPrefix '10.0.2.0/25' -DestinationPortRange '63389' -Protocol TCP
#Delete a rule from NSG
Get-AzureNetworkSecurityGroup -Name "DMZ_NSG" | Remove-AzureNetworkSecurityRule -Name RDPInternet-DMZ
#Associate a NSG to a Virtual machine
#!/bin/bash
#
# Automatic update for made-in-ovh OVH kernels.
#
# VERSION :0.2
# DATE :2015-02-10
# AUTHOR :Viktor Szépe <[email protected]>
# LICENSE :The MIT License (MIT)
# URL :https://github.com/szepeviktor/debian-server-tools
# BASH-VERSION :4.2+
# References:
# http://blog.mixu.net/2011/08/13/nginx-websockets-ssl-and-socket-io-deployment/
# http://blog.exceliance.fr/2012/09/10/how-to-get-ssl-with-haproxy-getting-rid-of-stunnel-stud-nginx-or-pound/
#
global
nbproc 2
maxconn 16384
defaults
# force HTTP to HTTPS - /etc/nginx/conf.d/nonssl.conf
server {
listen 80;
server_name jira.example.com;
access_log off;
return 301 https://$server_name$request_uri;
}
# /etc/nginx/conf.d/jira.conf
server {
@zz
zz / golang-static-complie.sh
Created April 19, 2015 15:58
Golang static build howto
$ go build -a -tags netgo -installsuffix netgo .
$ CGO_ENABLED=0 go build -a -installsuffix nocgo .

Client-side SSL

For excessively paranoid client authentication.

Using self-signed certificate.

Create a Certificate Authority root (which represents this server)

Organization & Common Name: Some human identifier for this server CA.

openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt
@zz
zz / CoreOS swap
Last active August 29, 2015 14:18 — forked from kacinskas/CoreOS swap
# swith to sudo
sudo -i
# create swap
touch /2GiB.swap
chattr +C /2GiB.swap
fallocate -l 2048m /2GiB.swap
chmod 600 /2GiB.swap
mkswap /2GiB.swap
@zz
zz / client.go
Last active August 29, 2015 14:15 — forked from spikebike/client.go
package main
import (
"crypto/tls"
"crypto/x509"
"fmt"
"io"
"log"
)
@zz
zz / hipchat.js
Last active August 29, 2015 14:14 — forked from hakobera/hipchat.js
/**
* HipChat client for Google Apps Script.
* This code is based on node-hipchat https://github.com/nkohari/node-hipchat/blob/master/lib/hipchat.js
*/
(function(global) {
var HipChatClient = (function () {
HipChatClient.prototype.host = 'api.hipchat.com';
function HipChatClient(apikey) {
@zz
zz / tls-client
Last active August 29, 2015 14:14 — forked from michaljemala/tls-client.go
package main
import (
"crypto/tls"
"crypto/x509"
"flag"
"io/ioutil"
"log"
"net/http"
)