Skip to content

Instantly share code, notes, and snippets.

View kevinn's full-sized avatar

Kevin Navia kevinn

View GitHub Profile
@kevinn
kevinn / fm.php
Created October 18, 2019 05:48 — forked from heiswayi/fm.php
Single PHP File Manager Script - Screenshot: https://i.imgur.com/4OtrKUz.png
<?php
/**
* File Manager Script
*/
// Default language ('en' and other from 'filemanager-l10n.php')
$lang = 'en';
// Auth with login/password (set true/false to enable/disable it)
$use_auth = true;
@kevinn
kevinn / readme.md
Last active July 31, 2019 01:39
Setting up PHP MySQL on Windows WSL

Setting up Apache, PHP, and MySQL on Windows WSL

Update package managers

$ sudo apt update
$ sudo apt upgrade

Install Apache2

$ sudo apt install apache2
$ mkdir /mnt/c/dev/wwwroot
$ sudo ln -s /mnt/c/dev/wwwroot /var/www/public

@kevinn
kevinn / mobile-check.js
Created June 17, 2019 03:40
Mobile User Agent check Javascript
// As always, user-agent detection is not recommended.
// Caveats apply, see: https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent
mobileCheck: function() {
return /Mobi|Android/i.test(navigator.userAgent);
}
@kevinn
kevinn / vue-heroku.md
Created April 12, 2019 12:52
Deploy Vue.js app /dist to Heroku
  1. Add express and serve-static via npm:
$ npm install express serve-static
  1. Create file named heroku.js on at the root directory of a Vue.js project:
const express = require('express');
const serveStatic = require("serve-static")
const path = require('path');
@kevinn
kevinn / docker-compose.yml
Created November 9, 2018 15:58
wordpress using docker
version: '3'
services:
wordpress:
image: wordpress:latest
restart: always
links:
- mysql
ports:
- 8080:80
@kevinn
kevinn / checkUpdateTextFile.js
Last active May 30, 2018 07:10
Check for a text file (markdown) and check contents (if new), update the UI to show unread state, and then display a modal. Uses localStorage set to two items for unread and text content.
// uses https://github.com/markedjs/marked to read markdown files to html
// uses jQuery because we're on old angular version
var checkUpdatesFile = function() {
$.ajax({
url: '/static/updates.md'
}).done(function(data){
var updateText = data;
// check/store in localStorage for updated text from updates.md
@kevinn
kevinn / readme.md
Last active December 8, 2019 12:53
Make Windows Subsystem Linux/lxss a bit faster on Win10.

**NOTE: After re-installing WSL, node/npm is spouting errors on permissions on the filesystem
sudo umount /mnt/c sudo mount -t drvfs C: /mnt/c -o metadata

Make Windows Subsystem Linux/lxss a bit faster on Win10.

Seen from here: microsoft/WSL#1932

  1. Go to "Windows Defender Security Center" via start menu or searching after pressing the Windows key.
@kevinn
kevinn / css.css
Created February 19, 2018 05:36
github's font-stack
body {
font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";
font-size: 14px;
line-height: 1.5;
}
code {
font-family: "SFMono-Regular",Consolas,"Liberation Mono",Menlo,Courier,monospace;
font-size: 12px;
}
@kevinn
kevinn / gifenc.sh
Last active March 31, 2017 04:27
High quality video to gif encoding using ffmpeg. From http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html
#!/bin/sh
# http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html
# usage: ./gifenc.sh [input].mov [output].gif
palette="palette.png"
filters="fps=15,scale=-1:-1:flags=lanczos"
ffmpeg -v warning -i $1 -vf "$filters,palettegen" -y $palette
@kevinn
kevinn / app.js
Created November 23, 2015 10:15 — forked from jrmoran/app.js
AngularJS - Charting with Flot
var App = angular.module('App', []);