Skip to content

Instantly share code, notes, and snippets.

View crossworth's full-sized avatar

Pedro Henrique crossworth

View GitHub Profile
# C++ objects and libs
*.slo
*.lo
*.o
*.a
*.la
*.lai
*.so
*.dll
npm set init.author.name "Pedro Henrique"
npm set init.author.email "system.pedrohenrique@gmail.com"
npm set init.author.url "http://pedrohenrique.ninja"
<?php
/**
* _ ____ _ ____
* / \ | _ \ / \ / ___|
* / _ \ | | | |/ _ \ \___ \
* / ___ \| |_| / ___ \ ___) |
* /_/ \_\____/_/ \_\____/
*
* ADAS - Automatic Data Acquisition System - AWStats v1.0
* Pedro Henrique - system.pedrohenrique@gmail.com
@crossworth
crossworth / .htaccess
Created October 10, 2017 04:30 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@crossworth
crossworth / git-deployment.md
Created February 25, 2018 02:34 — forked from noelboss/git-deployment.md
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your lokal GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like my Deepl.io to act upon a Web-Hook that's triggered that service.

Install Supervisor with sudo apt-get install supervisor in Unix or brew install supervisor in Mac OSX. Ensure it's started with sudo service supervisor restart in Unix or brew services start supervisor in Mac OSX.

In Unix in /etc/supervisord/conf.d/ create a .conf file. In this example, laravel_queue.conf (contents below). Give it execute permissions: chmod +x laravel_queue.conf.

In Mac OSX first run supervisord -c /usr/local/etc/supervisord.ini and in /usr/local/etc/supervisor.d/ create a .conf file. In this example, laravel_queue.conf (contents below). Give it execute permissions: chmod +x laravel_queue.conf.

This file points at /usr/local/bin/run_queue.sh, so create that file there. Give this execute permissions, too: chmod +x run_queue.sh.

Now update Supervisor with: sudo supervisorctl reread in Unix and with: brew services restart supervisor in MAc OSX . And start using those changes with: sudo supervisorctl update.

<?php
function dockerGet($endpoint) {
set_time_limit(0);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $endpoint);
curl_setopt($ch, CURLOPT_UNIX_SOCKET_PATH, '/var/run/docker.sock');
curl_setopt($ch, CURLOPT_BUFFERSIZE, 256);
@crossworth
crossworth / docker_problem.txt
Last active November 4, 2019 17:23
Docker freeze/stuck
com.docker.driver.amd64-linux.log
Not working log:
time="2019-11-04T12:47:37-03:00" level=info msg="Ports are not available: unable to list exposed ports: Get http://unix/forwards/list: net/http: request canceled (Client.Timeout exceeded while awaiting headers)"
time="2019-11-04T12:47:37-03:00" level=info msg="Cancel connection..."
Working log:
time="2019-11-04T13:33:35-03:00" level=info msg="proxy >> GET /forwards/list\n"
The problem is that VPNKit cannot list the ports.
@crossworth
crossworth / ocaml_lwt_sample.ml
Created February 10, 2020 16:28 — forked from mjambon/ocaml_lwt_sample.ml
OCaml/Lwt crash course. Adult supervision recommended.
(*
Interactive approach
--------------------
You can copy-paste code into `utop`, provided you load the lwt.unix
package:
#use "topfind";;
#require "lwt.unix";;
@crossworth
crossworth / sort.go
Created March 30, 2020 23:30
sort file by mod time
package main
import (
"fmt"
"path/filepath"
"time"
"sort"
"gopkg.in/djherbis/times.v1"
"os"
)