Skip to content

Instantly share code, notes, and snippets.

@minostro
minostro / gist:11387989
Last active February 18, 2019 16:43
Configuring Nginx on Webfaction

1.- Get into the src folder, download & extract nginx source

  • cd ~/src
  • curl -O http://nginx.org/download/nginx-1.7.0.tar.gz
  • tar -xzvf nginx-1.7.0.tar.gz
  • cd nginx-1.7.0

2.- Configuring the source

./configure --prefix=$HOME/local/nginx \

worker_processes 2;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
server {
listen 17743;
server_name axion.webfactional.com;
location / {
proxy_pass http://127.0.0.1:13459;
}
location /static/ {
root /home/axion/webapps/taxicab_fees/current/;
application:start(inets).
SoapBody = "<soap:Body><GetWeather xmlns=\"http://www.webserviceX.NET\"><CityName>Chicago</CityName><CountryName>United States</CountryName></GetWeather></soap:Body>".
SoapEnvelope = lists:append([
"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">",
SoapBody,
"</soap:Envelope>"]
).
{ok, {{_, _, _}, _, ResponseBody}} = httpc:request(post, {"http://www.webservicex.net/globalweather.asmx", [], "text/xml", SoapEnvelope}, [], []).
{Xml, _} = xmerl_scan:string(ResponseBody).
{_, _, [{_, _, [{_, _, [{_, [], Data}]}]}]} = xmerl_lib:simplify_element(Xml).
#include <stdio.h>
int* initialize_array(int n) {
int array[n];
for(int i=0; i<n; i=i+1){
array[i] = i+1;
}
return array;
}
#include <stdio.h>
#include <stdlib.h>
int* initialize_array(int n) {
int* array = (int *) malloc(n * sizeof(int)); //allocate memory in the Heap
for(int i=0; i<n; i=i+1){
array[i] = i+1;
}
return array;
}
-module(queue_adt).
-export([empty_queue/0,
enqueue/2,
dequeue/1,
current/1]).
empty_queue() ->
{[], []}.
enqueue({[Value], []}, Element) ->
@minostro
minostro / AbstractGrammar.java
Last active May 30, 2017 22:02
Join Point Interfaces
JPITypeDecl : TypeDecl ::=
ReturnType:Access Parameters:ParameterDeclaration* Exception:Access*; SuperTypeName:Access SuperArgumentName:Access*;
ExhibitBodyDecl : BodyDecl ::=
ReturnType:Access JPIName:Access Parameter:ParameterDeclaration* Pointcut:PointcutExpr;
CJPAdviceDecl : AdviceDecl;
CJPPointcutExpr: PointcutExpr;
CJPBeforeSpec : BeforeSpec ::= JPIName:Access;
/*the rest of the advice specifications are omitted from this listing*/
@minostro
minostro / script.py
Created September 27, 2017 13:36
Generate Nubox Document
from facturacion.models import DocumentoContable
from utils.nubox import actions as nubox_actions
from settings import FACTURACION_CSV_DIR, FACTURACION_PDF_DIR
from utils.nubox.client import Client
documento_contable = DocumentoContable.objects.get(id=1/0)
documento_map = documento_contable.print_repr()
extended_document = nubox_actions.create_extended_document(documento_map)
@minostro
minostro / script.py
Created October 4, 2017 17:02
Create a Documento Contable
from facturacion.models import DocumentoContable
from utils.nubox import actions as nubox_actions
from settings import FACTURACION_CSV_DIR, FACTURACION_PDF_DIR
from utils.nubox.client import Client
documento_contable = DocumentoContable.objects.get(id=1/0)
documento_map = documento_contable.print_repr()
extended_document = nubox_actions.create_extended_document(documento_map)