Skip to content

Instantly share code, notes, and snippets.

View mcspx's full-sized avatar

@mcspx mcspx

  • M STACK CO.,LTD.
View GitHub Profile
@mcspx
mcspx / Laravel PHP7 LEMP AWS.md
Created June 9, 2017 17:35 — forked from santoshachari/Laravel PHP7 LEMP AWS.md
Laravel 5.x on Ubuntu 16.x, PHP 7.x, Nginx 1.9.x

#Steps to install latest Laravel, LEMP on AWS Ubuntu 16.4 version. This tutorial is the improvised verision of this tutorial on Digitalocean based on my experience.

Install PHP 7 on Ubuntu

Run the following commands in sequence.

sudo apt-get install -y language-pack-en-base
sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install zip unzip
@mcspx
mcspx / python_opencv_camera_haar.py
Created November 4, 2017 04:29 — forked from radames/python_opencv_camera_haar.py
Example of Python with Opencv and camera face detection
import cv2
cap = cv2.VideoCapture(0)
cap.set(3, 640) #WIDTH
cap.set(4, 480) #HEIGHT
face_cascade = cv2.CascadeClassifier('/usr/local/Cellar/opencv/2.4.13/share/OpenCV/haarcascades/haarcascade_frontalface_default.xml')
eye_cascade = cv2.CascadeClassifier('/usr/local/Cellar/opencv/2.4.13/share/OpenCV/haarcascades/haarcascade_eye.xml')
while(True):
@mcspx
mcspx / gps.hpp
Created January 5, 2018 17:45 — forked from nazt/gps.hpp
gps.hpp
#include <Arduino.h>
#include "gnss.h"
GNSS gps;
float GPS_SEARCH_TIMEOUT_S = 40;
extern uint8_t LED;
// volatile char GNSS_data[58] = "";
char GNSS_data[58] = "";
String gps_data = "";
@mcspx
mcspx / lazy-load-puppeteer.js
Created October 2, 2019 20:53 — forked from schnerd/lazy-load-puppeteer.js
Lazy-loading content in Puppeteer
function wait (ms) {
return new Promise(resolve => setTimeout(() => resolve(), ms));
}
export default async function capture(browser, url) {
// Load the specified page
const page = await browser.newPage();
await page.goto(url, {waitUntil: 'load'});
// Get the height of the rendered page
@mcspx
mcspx / golang-tls.md
Created October 7, 2019 18:20 — forked from denji/golang-tls.md
Simple Golang HTTPS/TLS Examples
Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
@mcspx
mcspx / golang-tls.md
Created October 10, 2019 02:17 — forked from 6174/golang-tls.md
Simple Golang HTTPS/TLS Examples
Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048
    
# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
openssl ecparam -genkey -name secp384r1 -out server.key
@mcspx
mcspx / README.md
Created January 19, 2020 21:03 — forked from tissera/README.md
D3v4 Liquid Fill Gauge Chart with animations
@mcspx
mcspx / index.html
Created September 2, 2020 19:46 — forked from kristw/index.html
Thailand map
<!DOCTYPE html>
<meta charset="utf-8">
<style>
@import url(http://fonts.googleapis.com/css?family=Open+Sans+Condensed:300|Josefin+Slab|Arvo|Lato|Vollkorn|Abril+Fatface|Old+Standard+TT|Droid+Sans|Lobster|Inconsolata|Montserrat|Playfair+Display|Karla|Alegreya|Libre+Baskerville|Merriweather|Lora|Archivo+Narrow|Neuton|Signika|Questrial|Fjalla+One|Bitter|Varela+Round);
.background {
fill: #eee;
pointer-events: all;
}
func (s *Service) processPage(id string, job Job) (err error) {
ctx, cancel := context.WithTimeout(context.Background(), s.ContextTimeout)
defer cancel()
url := fmt.Sprintf("http://%s", s.CDTAddress)
devt := devtool.New(url)
tab, err := devt.CreateURL(ctx, "https://google.com")
if err != nil {
return err
@mcspx
mcspx / Netwatch.rsc
Created December 21, 2020 18:01 — forked from heri16/Netwatch.rsc
Mikrotik RouterOS script for Ping-based Fast Failover with PPPoE uplinks.
/interface pppoe-client
set [find name="internet-speedy"] comment="PROVIDER1"
set [find name="internet-biznet"] comment="PROVIDER2"
/ip route
add comment="Force test pings through PROVIDER1" distance=1 dst-address=4.2.2.4/32 gateway=internet-speedy
add comment="Block test pings through other providers" distance=20 dst-address=4.2.2.4/32 type=blackhole
/tool netwatch
add comment=CheckCon down-script=":local \"p1\" [/interface pppoe-client find c\