Skip to content

Instantly share code, notes, and snippets.

View andrematias's full-sized avatar
🏠
Working from home

André Matias andrematias

🏠
Working from home
View GitHub Profile
@andrematias
andrematias / __upload_file.md
Created March 21, 2022 19:36 — forked from maxivak/__upload_file.md
PHP upload file with curl (multipart/form-data)

We want to upload file to a server with POST HTTP request. We will use curl functions.

// data fields for POST request
$fields = array("f1"=>"value1", "another_field2"=>"anothervalue");

// files to upload
$filenames = array("/tmp/1.jpg", "/tmp/2.png");
@andrematias
andrematias / INSTALL.md
Created March 20, 2022 09:58 — forked from takeit/INSTALL.md
Write to NTFS on macOS Sierra (osxfuse + ntfs-3g)
  1. Install osxfuse:
brew cask install osxfuse
  1. Reboot your Mac.

  2. Install ntfs-3g:

@andrematias
andrematias / md5Filecompare.ps1
Last active April 29, 2021 17:41
Um script basico para gerar um md5 de arquivos e compara-los
Param (
$FirstFile = $(throw "Um primeiro arquivo eh requerido"),
$SecondFile = $(throw "Um segundo arquivo eh requerido")
)
function md5hash($path)
{
$md5 = new-object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider
$file = [System.IO.File]::Open($path,[System.IO.Filemode]::Open, [System.IO.FileAccess]::Read)
try {
" Specify a directory for plugins
" - For Neovim: stdpath('data') . '/plugged'
" - Avoid using standard Vim directory names like 'plugin'
call plug#begin('~/.vim/plugged')
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'Valloric/YouCompleteMe', { 'do': './install.py --tern-completer' }
Plug 'eslint/eslint'
Plug 'dense-analysis/ale'
Plug 'pangloss/vim-javascript' " JavaScript support
Plug 'leafgarland/typescript-vim' " TypeScript syntax
" Set compatibility to Vim only.
set nocompatible
" Helps force plug-ins to load correctly when it is turned back on below.
filetype off
" Turn on syntax highlighting.
syntax on
" For plug-ins to load correctly.
@andrematias
andrematias / callback_example.js
Created August 17, 2020 19:14
This gist is part of the book Learning Node by Shelley Powers, Novatec 2017
const fb = (n) => {
if(n<2) return n;
return fb(n -1) + fb(n -2);
}
const Obj = function(){};
Obj.prototype.doSomething = function(arg1_){
const callback_ = arguments[arguments.length - 1]; //This word 'arguments' just works with anonymous function
callback = (typeof(callback_) == 'function' ? callback_ : null);
@andrematias
andrematias / .git-commit-template
Last active July 28, 2020 20:50 — forked from zakkak/.git-commit-template
This commit message template that helps you write great commit messages and enforce it across your team.
# [<tag>] (If applied, this commit will...) <subject> (Max 72 char)
# |<---- Preferably using up to 50 chars --->|<------------------->|
# Example:
# [feat] Implement automated commit messages
# (Optional) Explain why this change is being made
# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->|
# (Optional) Provide links or keys to any relevant tickets, articles or other resources
# Example: Github issue #23
@andrematias
andrematias / powershell_telnet.ps1
Last active July 28, 2020 19:24
An alternative solution for telnet using PowerShell
<#
.Synopsis
Tests the connectivity between two computers on a TCP Port
.Description
The Telnet command tests the connectivity between two computers on a TCP Port. By running this command, you can determine if specific service is running on Server.
.Parameter <ComputerName>
This is a required parameter where you need to specify a computer name which can be localhost or a remote computer
@andrematias
andrematias / index.html
Created December 19, 2017 23:12 — forked from umidjons/index.html
Upload File using jQuery.ajax() with progress support
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Upload File using jQuery.ajax() with progress support</title>
</head>
<body>
<input type="file" name="file" id="sel-file"/>
server {
# see: http://wiki.nginx.org/Pitfalls
# see: http://wiki.nginx.org/IfIsEvil
listen 80;
root /app;
index index.html index.htm index.php;
error_page 404 /index.php;
# Make site accessible from http://set-ip-address.xip.io