Skip to content

Instantly share code, notes, and snippets.

@gotomypc
gotomypc / s3upload.js
Created October 23, 2022 01:16 — forked from marksilvis/s3upload.js
Node.js upload to AWS S3
// requires AWS SDK
var AWS = require('aws-sdk')
, fs = require('fs');
var s3 = new AWS.S3({
apiVersion: '2006-03-01',
accessKeyId: 'AccessKey',
secretAccessKey: 'SecretKey',
region: 'region'
});
@gotomypc
gotomypc / tornado_background.py
Created October 23, 2022 01:15 — forked from marksilvis/tornado_background.py
Tornado example with non-blocking background tasks executed in thread pool
import time
from tornado import (
concurrent,
gen,
httpserver,
ioloop,
log,
web
)
@gotomypc
gotomypc / tornado_multiproc.py
Created October 23, 2022 01:14 — forked from marksilvis/tornado_multiproc.py
Example Tornado server with multiple processes running background tasks
import time
form tornado import (
concurrent,
gen,
httpserver,
ioloop,
log,
process,
web
'use strict';
/*
# Javascript Prototyping Best Practices
* To create a class, create a constructor function with a `Name` and assign
it to a variable of the same `Name`.
* In this constructor only define properties using `this.prop` notation
@gotomypc
gotomypc / GoDaddySSLHAProxy.md
Created October 7, 2016 06:00 — forked from sethwebster/GoDaddySSLHAProxy.md
Creating a PEM for HaProxy from GoDaddy SSL Certificate

GoDaddy SSL Certificates PEM Creation for HaProxy (Ubuntu 14.04)

1 Acquire your SSL Certificate

Generate your CSR This generates a unique private key, skip this if you already have one.

sudo openssl genrsa -out  etc/ssl/yourdomain.com/yourdomain.com.key 1024

Next generate your CSR (Certificate Signing Request), required by GoDaddy:

@gotomypc
gotomypc / Twelve_Go_Best_Practices.md
Created February 2, 2016 16:10 — forked from pzurek/Twelve_Go_Best_Practices.md
Twelve Go Best Practices
@gotomypc
gotomypc / AES.c
Last active August 29, 2015 14:14 — forked from bricef/AES.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
* MCrypt API available online:
* http://linux.die.net/man/3/mcrypt
*/
#include <mcrypt.h>
# verifica encoding do arquivo
$ file -I script_perebento.sql
$ file -bI script_perebento.sql
# converte arquivo de ISO-8859-1 para UTF-8
$ iconv -f ISO-8859-1 -t UTF-8 script_perebento.sql > script_bonitao.sql
'use strict';
var mysqlBackup = require('./mysql-backup');
var schedule = require('node-schedule');
schedule.scheduleJob({ hour: 22, minute: 0 }, mysqlBackup);
@gotomypc
gotomypc / nginx.conf
Last active August 29, 2015 14:09 — forked from phpdude/nginx.conf
location /resize {
alias /tmp/nginx/resize;
set $width 150;
set $height 100;
set $dimens "";
if ($uri ~* "^/resize_(\d+)x(\d+)/(.*)" ) {
set $width $1;
set $height $2;
set $image_path $3;