Skip to content

Instantly share code, notes, and snippets.

View kilisio's full-sized avatar
👓
One line of code at a time...

Patrick Kilisio kilisio

👓
One line of code at a time...
View GitHub Profile
@kilisio
kilisio / server.js
Created October 15, 2019 19:33 — forked from taion/server.js
GraphQL subscription server with Socket.IO, backed by Redis Pub/Sub
const redisClient = redis.createClient(REDIS_URL);
const listeners = Object.create(null);
function addListener(channel, listener) {
if (!listeners[channel]) {
listeners[channel] = [];
redisClient.subscribe(channel);
}
listeners[channel].push(listener);
@kilisio
kilisio / Nested-Routers-Express.md
Created October 20, 2019 16:22 — forked from zcaceres/Nested-Routers-Express.md
Child Routers in Express

Nested Routers in Express.js

Express makes it easy to nest routes in your routers. But I always had trouble accessing the request object's .params when you had a long URI with multiple parameters and nested routes.

Let's say you're building routes for a website www.music.com. Music is organized into albums with multiple tracks. Users can click to see a track list. Then they can select a single track and see a sub-page about that specific track.

At our application level, we could first have a Router to handle any requests to our albums.

const express = require('express');
@kilisio
kilisio / HTML Basic file - minimum
Last active October 27, 2019 15:23 — forked from kwechsler/HTML Basic file - minimum
HTML: Basic file - minimum
<!DOCTYPE HTML>
<html>
<head>
</head>
<body>
</body>
</html>
@kilisio
kilisio / emoji.md
Last active October 30, 2019 22:41 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@kilisio
kilisio / index.html
Created November 12, 2019 21:53 — forked from gaearon/index.html
Add React in One Minute
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Add React in One Minute</title>
</head>
<body>
<h2>Add React in One Minute</h2>
<p>This page demonstrates using React with no build tooling.</p>
@kilisio
kilisio / m3u8-to-mp4.md
Created March 9, 2020 12:01 — forked from tzmartin/m3u8-to-mp4.md
m3u8 stream to mp4 using ffmpeg

1. Copy m3u8 link

Alt text

2. Run command

echo "Enter m3u8 link:";read link;echo "Enter output filename:";read filename;ffmpeg -i "$link" -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 $filename.mp4
@kilisio
kilisio / image-arraybuffer.js
Created May 6, 2020 07:28 — forked from candycode/image-arraybuffer.js
Create a jpg image from ArrayBuffer data
// Simulate a call to Dropbox or other service that can
// return an image as an ArrayBuffer.
var xhr = new XMLHttpRequest();
// Use JSFiddle logo as a sample image to avoid complicating
// this example with cross-domain issues.
xhr.open( "GET", "http://fiddle.jshell.net/img/logo.png", true );
// Ask for the result as an ArrayBuffer.
xhr.responseType = "arraybuffer";
@kilisio
kilisio / b64toBlob.js
Created May 6, 2020 07:29 — forked from jdnichollsc/b64toBlob.js
Convert to Blob with Javascript
//By https://codedump.io/share/Fd3DmsM6UAeS/1/creating-a-blob-from-a-base64-string-in-javascript
//Example
//var blob = b64toBlob(b64Data, contentType);
//var blobUrl = URL.createObjectURL(blob);
function b64toBlob(b64Data, contentType, sliceSize) {
contentType = contentType || 'image/png';
sliceSize = sliceSize || 512;
var byteCharacters = atob(b64Data);
var byteArrays = [];
@kilisio
kilisio / QEMU - OpenWRT x86_64.md
Last active August 3, 2020 04:50 — forked from rodrigojusto/EVE-NG - OpenWRT x86
create openwrt qemu image

QEMU - OpenWRT x86_64

    qemu-img create -f qcow2 hda.qcow2 1G
    # expected output
    Formatting 'hda.qcow2', fmt=qcow2 size=1073741824 encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16

    ll
    # expected output
    -rw-r--r--  1 root root 42281968 Aug 12 02:23 hda.qcow2
    -rw-r--r--  1 root root 42281968 Aug 12 02:19 openwrt-koolshare-mod-v2.19-r8118-26796a2-x86-64-combined-squashfs.img.gz
@kilisio
kilisio / create_vm.sh
Created August 6, 2020 19:29 — forked from sickbock/create_vm.sh
VirtualBox PXE boot
#!/bin/bash
cd ${myVMs}
MyVM=testvm
vboxmanage unregistervm ${MyVM} --delete
rm -rf ${MyVM}
mkdir ${MyVM}
cd ${MyVM}
vboxmanage createhd --filename ${MyVM}.vdi --size 30720
vboxmanage createvm --name ${MyVM} --ostype RedHat_64 --register
vboxmanage modifyvm ${MyVM} --memory 6172 --vram=12 --acpi on --nic1 NAT # optional second NIC # --nic2 bridged --bridgeadapter2 enp0s25