Skip to content

Instantly share code, notes, and snippets.

View msurguy's full-sized avatar

Maksim Surguy msurguy

View GitHub Profile
@msurguy
msurguy / basic-auth-module.js
Created July 25, 2019 18:20
Nuxt.js Basic Auth
const { createMiddleware } = require('./basic-auth')
export default function (moduleOptions) {
const options = Object.assign({}, this.options.basic, moduleOptions || {})
const { name, pass, enabled } = options
if (!(name && pass)) {
console.log('name or pass not found. Skip registration of authentication server.')
return false
}
if (enabled === false) {
@msurguy
msurguy / timelapse.md
Created July 21, 2019 21:14 — forked from alexellis/timelapse.md
ffmpeg time-lapse

Convert sequence of JPEG images to MP4 video

ffmpeg -r 24 -pattern_type glob -i '*.JPG' -i DSC_%04d.JPG -s hd1080 -vcodec libx264 timelapse.mp4

  • -r 24 - output frame rate
  • -pattern_type glob -i '*.JPG' - all JPG files in the current directory
  • -i DSC_%04d.JPG - e.g. DSC_0397.JPG
  • -s hd1080 - 1920x1080 resolution

Slower, better quality

@msurguy
msurguy / index.html
Created October 26, 2017 04:48 — forked from bellbind/index.html
[html5][devicemotion]live demo of devicemoton event
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>devicemotion event</title>
<script src="script.js"></script>
</head>
<body>
<h1>devicemotion event demo</h1>
<p>
@msurguy
msurguy / readme.md
Created May 15, 2019 16:19
timelapse video from GoPro Hero photos
ffmpeg \
  -r 15000/1001 \
  -pattern_type glob -i '*.JPG' \
  -vf "crop=in_w:in_w*9/16,scale=3840:-2" \
  -sws_flags lanczos \
  -pix_fmt yuv420p \
  -vcodec libx264 \
  output2.mkv
@msurguy
msurguy / Instructions.md
Last active May 14, 2019 16:38
Daily reports in 5 minutes with Laravel and Morris.js

Follow this guide to integrate bar chart reports into your Laravel application. Reports like the following come with this guide:

  • Total number of Orders by day
  • Total number of Users subscribed by day
  • etc

The library used for the charts is: http://www.oesmith.co.uk/morris.js/

First put this into your page that will have the reports (in the Blade view) to include Morris library:

@msurguy
msurguy / opencv_install.sh
Last active April 9, 2019 04:17
Jetson Nano OpenCV 4.0.0 install script
#!/bin/bash
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <Install Folder>"
exit
fi
folder="$1"
user="nvidia"
passwd="nvidia"
@msurguy
msurguy / about.md
Created April 8, 2019 23:53 — forked from mattdesl/about.md
A Browser and Node.js compatible canvas-sketch script for generative and parametric 3D geometry.

Generative Geometry in Browser + Node.js

Here is a script that can be run with canvas-sketch to generate OBJ files from a parametric/algorithmic 3D ThreeJS geometry.

Hitting "Cmd + S" from the canvas-sketch tool will export a PNG and OBJ file of the scene.

If the same script is run from Node, it will simply render the OBJ to stdout, or write to the filename argument if given.

@msurguy
msurguy / downloader.py
Created March 29, 2019 05:58
Pythoin File downloader
import csv, sys
#import requests
import urllib.request
#from urllib.request import urlopen
import os
filename = 'test.csv'
with open(filename, mode='r', encoding='utf-8-sig') as f:
reader = csv.reader(f)
try:
@msurguy
msurguy / .block
Created February 22, 2019 07:36 — forked from getflourish/.block
D3 + Vue.js
license: mit
@msurguy
msurguy / bunny.go
Created November 18, 2018 09:27
3D line engine with UI
package main
import "github.com/fogleman/ln/ln"
import (
"net/http"
"io/ioutil"
"strconv"
"fmt"
)