Skip to content

Instantly share code, notes, and snippets.

@CJavierSaldana
CJavierSaldana / install-openssh-windows-server-2016.ps1
Created September 16, 2021 13:35
Install OpenSSH on Windows Server 2016
# Execute it with elevated permissions
# Description:
# This script install automatically the open-ssh feature and enable it
# enable tls1.2 for downloads
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
# creating openssh folder and download the zip
mkdir c:\openssh-install
cd c:\openssh-install
@minhphuc429
minhphuc429 / hash.mqh
Created March 28, 2020 22:24
Libraries: JSON Parser MQL4
// $Id: hash.mqh 125 2014-03-03 08:38:32Z ydrol $
#ifndef YDROL_HASH_MQH
#define YDROL_HASH_MQH
//#property strict
/*
This is losely ported from a C version I have which was in turn modified from hashtable.c by Christopher Clark.
Copyright (C) 2014, Andrew Lord (NICKNAME=lordy) <forex@NICKNAME.org.uk>
Copyright (C) 2002, 2004 Christopher Clark <firstname.lastname@cl.cam.ac.uk>
@alexcorvi
alexcorvi / mime2ext.php
Created June 29, 2016 10:04
converting mime types to extension in php
function mime2ext($mime){
$all_mimes = '{"png":["image\/png","image\/x-png"],"bmp":["image\/bmp","image\/x-bmp","image\/x-bitmap","image\/x-xbitmap","image\/x-win-bitmap","image\/x-windows-bmp","image\/ms-bmp","image\/x-ms-bmp","application\/bmp","application\/x-bmp","application\/x-win-bitmap"],"gif":["image\/gif"],"jpeg":["image\/jpeg","image\/pjpeg"],"xspf":["application\/xspf+xml"],"vlc":["application\/videolan"],"wmv":["video\/x-ms-wmv","video\/x-ms-asf"],"au":["audio\/x-au"],"ac3":["audio\/ac3"],"flac":["audio\/x-flac"],"ogg":["audio\/ogg","video\/ogg","application\/ogg"],"kmz":["application\/vnd.google-earth.kmz"],"kml":["application\/vnd.google-earth.kml+xml"],"rtx":["text\/richtext"],"rtf":["text\/rtf"],"jar":["application\/java-archive","application\/x-java-application","application\/x-jar"],"zip":["application\/x-zip","application\/zip","application\/x-zip-compressed","application\/s-compressed","multipart\/x-zip"],"7zip":["application\/x-compressed"],"xml":["application\/xml","text\/xml"],"svg":
@subfuzion
subfuzion / curl.md
Last active July 18, 2024 17:12
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@vluzrmos
vluzrmos / compat_l5.php
Last active November 1, 2022 20:43
Lumen L5 compatibility helpers. That file should be added on root path of your project... and added to your composer.json
<?php
if(!function_exists('config_path'))
{
/**
* Return the path to config files
* @param null $path
* @return string
*/
function config_path($path=null)
@jmsaavedra
jmsaavedra / ffmpeg_install.md
Last active June 7, 2024 17:33
Install FFmpeg on a Linux Box

Install FFmpeg via CLI on Linux box

These steps walk through installing a static binary of any ffmpeg version on to your linux machine. If you want to compile from source, there are several ways to do so. Here's the official guide. Tested and works on an AWS EC2 Ubuntu instance, but should work on any Linux machine.

  • SSH into your instance and become root
<?php
/**
* Get the file size of any remote resource (using get_headers()),
* either in bytes or - default - as human-readable formatted string.
*
* @author Stephan Schmitz <eyecatchup@gmail.com>
* @license MIT <http://eyecatchup.mit-license.org/>
* @url <https://gist.github.com/eyecatchup/f26300ffd7e50a92bc4d>
*
* @param string $url Takes the remote object's URL.
string VERSION = "TL BO 1.0";
// external global variables
extern int EXT_SWINGS = 2; // swing level, 0 is lowest, 2 is most common
extern int EXT_NO_SWING_LMT = 12; // don't consider the latest X bars as swing points to draw trend lines
extern int EXT_ATR = 300; // ATR(x)
extern double EXT_ATR_MAX_SLOPE = 0.05; // multiple of ATR that would be considered maximum slope
extern double EXT_ATR_BUFFER = 0.05; // multiple of ATR to add to low/high for it to be considered a "touch"
extern int EXT_NULL_CLOSES = 0; // number of closes beyond trend line to nullify it as a valid trend line
extern int EXT_NUM_TOUCHES = 3; // (inclusive) number of touches needed to be considered a valid trend line
@ozh
ozh / gist:4131243
Created November 22, 2012 13:44
Create dot files/directories (ie .file) on Windows

#How to create a .file or .folder on Windows

There are several ways

1. Rename

  • Create file.txt
  • Rename to .file., the last dot will be dropped, you'll have .file

Works the same with a file or a directory.

@jk
jk / trait.properties.php
Created July 7, 2012 13:49
Example of PHP traits to implement real properties in PHP classes
<?php
/**
* Real properties PHP trait
* Requirements: PHP 5.4 or later
*/
trait Properties
{
protected $properties;
public function __get($name)