Skip to content

Instantly share code, notes, and snippets.

@defp
defp / zabbix_smtp.go
Created September 15, 2014 16:39
zabbix smtp send email
package main
import (
"encoding/base64"
"fmt"
"net/mail"
"net/smtp"
"os"
"strings"
)
@chrisgillis
chrisgillis / ssl_smtp_example.go
Created April 16, 2014 14:48
Golang SSL SMTP Example
package main
import (
"fmt"
"log"
"net"
"net/mail"
"net/smtp"
"crypto/tls"
)
@blikenoother
blikenoother / Installing 3rd Party Nginx module with apt-get
Last active August 31, 2024 09:16
Install 3rd party module and build NGINX debian (.deb) package. Following is guide for nginx_upstream_check_module
#Install dpkg-dev and package dependencies
sudo apt-get install dpkg-dev
sudo apt-get install software-properties-common
sudo apt-get install python-software-properties
sudo apt-get install init-system-helpers
#Add repository:
sudo add-apt-repository ppa:nginx/stable
#Edit /etc/apt/sources.list.d/nginx-stable-lucid.list, add dpkg-src (no need if ubuntu verson >= 12.04):
@plentz
plentz / nginx.conf
Last active October 22, 2025 16:10
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@louismullie
louismullie / encrypted-ajax.js
Last active March 25, 2019 16:18
Encrypted AJAX wrapper for jQuery.
var key = 'password';
$.encAjax = function (url, options) {
options.data = options.data || {};
var data = JSON.stringify(options.data);
var encryptedData = sjcl.encrypt(key, data);
@ninehills
ninehills / backgroudmix.py
Last active December 10, 2015 17:08 — forked from methane/gist:2185380
tornado add block task to ThreadPool
from time import sleep
import tornado
from multiprocessing.pool import ThreadPool
_workers = ThreadPool(10)
class BackgroundMix(tornado.web.RequestHandler):
"""将block任务放入线程池中执行
EXAMPLE:
# blocking task like querying to MySQL
@jrmoran
jrmoran / app.js
Created October 27, 2012 21:58
AngularJS - Charting with Flot
var App = angular.module('App', []);
@lost-theory
lost-theory / gist:3925738
Created October 21, 2012 04:29
different delimiters in jinja2 + flask
from flask import Flask, render_template_string, request
class CustomFlask(Flask):
jinja_options = Flask.jinja_options.copy()
jinja_options.update(dict(
block_start_string='<%',
block_end_string='%>',
variable_start_string='%%',
variable_end_string='%%',
comment_start_string='<#',
@jl2
jl2 / wordgraph.go
Created October 5, 2012 07:59
Use Go and Dot to create a directed graph from a text file. Don't know what this could be used for, but it looks neat.
package main
// Create a directed graph based on the words in a text file.
// For example the sentences "This is some text. What is this good for?" would produce the following digraph:
// digraph graph {
// This -> is
// is -> some
// some -> text
// What -> is
@UniIsland
UniIsland / SimpleHTTPServerWithUpload.py
Created August 14, 2012 04:01
Simple Python Http Server with Upload
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""