Skip to content

Instantly share code, notes, and snippets.

View Alexufo's full-sized avatar

Alexandr Alexufo

  • Russia, Tula
View GitHub Profile
@xaliphostes
xaliphostes / README.md
Last active February 7, 2024 08:53
Emscripten pthread lib in web worker

A small multi-threaded C++ library (so, does not include any main) compiled with emscripten and pthread running under the main thread in the browser, a web worker or using node.js.

Note: Emscripten will produce lib.js.

Using a web browser

Running this lib in the main thread is fine but, obviously, block the main thread. Running it using a web worker leads no error with modification of the worker script (see below)

Using node.js

Run fine except that it prevents Node app from ever exiting.

@jeromecoupe
jeromecoupe / webstoemp-gulpfile.js
Last active January 21, 2024 16:28
Gulp 4 sample gulpfile.js. For a full explanation, have a look at https://www.webstoemp.com/blog/switching-to-gulp4/
"use strict";
// Load plugins
const autoprefixer = require("autoprefixer");
const browsersync = require("browser-sync").create();
const cp = require("child_process");
const cssnano = require("cssnano");
const del = require("del");
const eslint = require("gulp-eslint");
const gulp = require("gulp");
@odai-alali
odai-alali / js_functions_equivalent.java
Created February 22, 2018 11:12
The equivalent to a JavaScript setInterval/setTimeout in Android/Java?
// setInterval()
new Timer().scheduleAtFixedRate(new TimerTask(){
@Override
public void run(){
Log.i("interval", "This function is called every 5 seconds.");
}
},0,5000);
// setTimeout()
new android.os.Handler().postDelayed(
@estorgio
estorgio / Mounting VirtualBox shared folders on Ubuntu Server 16.04 LTS.md
Last active March 8, 2024 17:34
Mounting VirtualBox shared folders on Ubuntu Server 16.04 LTS

Update 28 July 2019: An updated version of this guide for Ubuntu Server 18.04 LTS is now available. Feel free to check it out.

Update 23 May 2020: This guide is ALREADY OUTDATED and might no longer work with new versions of Ubuntu and VirtualBox. Please consider switching to the updated guide instead. I will no longer respond to the replies to this gist. Thank you.

Mounting VirtualBox shared folders on Ubuntu Server 16.04 LTS

This guide will walk you through steps on how to setup a VirtualBox shared folder inside your Ubuntu Server guest. Tested on Ubuntu Server 16.04.3 LTS (Xenial Xerus)

@chourobin
chourobin / 0-bridging-react-native-cheatsheet.md
Last active May 4, 2024 14:06
React Native Bridging Cheatsheet
@andrewn
andrewn / instructions.md
Last active November 14, 2023 13:17
Testing SSL (LetsEncrypt certificate and loopback domain)

Testing SSL (LetsEncrypt certificate and loopback domain)

General approach

This sets up a publically-available domain that loops back to localhost IP address 127.0.0.1. For example, this address could be localhost.example.com if we controlled the example.com domain. This relies on having a public domain name whose DNS records you can control. We can then generate LetsEncrypt certificates for this domain.

Our HTTP server runs on localhost:80 (default HTTP port). This lets us visit http://localhost.example.com in a web browser and see the server running on localhost:80.

We then run an HTTPS proxy server on localhost:443 (default HTTPS port) that uses the LetsEncrypt certificates we generated for localhost.example.com. Visiting https://localhost.example.com hits the proxy, which returns the correct certificates meaning the browser displays the "Secure" message. The proxy then passes the request through to the HTTP server.

@allusis
allusis / navigation.pug
Last active March 4, 2023 14:59
Pug nav template with active link checker
block PrimaryNavigation
- var NavItems = [{'url':'home','title':'Home', 'img':'nav','key':'home'},{'url':'about-us','title':'About Us', 'img':'nav','key':'about-us'}];
header
each page,i in NavItems
if PageID === page.url
a(class="active", href= + page.url + '.html')
svg
use(xlink:href= 'img/sprites/' + page.img + '.svg#' + page.key)
span.name= page.title
@zhy0
zhy0 / ubuntu-cli-install-android-sdk.sh
Last active February 3, 2024 08:19
Install Android SDK on headless Ubuntu linux machine via command line, so that you can compile open source Android apps.
#!/bin/bash
# Thanks to https://gist.github.com/wenzhixin/43cf3ce909c24948c6e7
# Execute this script in your home directory. Lines 17 and 21 will prompt you for a y/n
# Install Oracle JDK 8
add-apt-repository ppa:webupd8team/java
apt-get update
apt-get install -y oracle-java8-installer
apt-get install -y unzip make # NDK stuff
@wgv-zbonham
wgv-zbonham / GenerateCertificate.md
Last active April 26, 2016 22:40
Generating a private PFX certificate using openssl tools.

This configuration file does not ship with the version of openssl I pulled for some reason. Found a default openssl.cnf

  1. generate an RSA private key
  • openssl genrsa -des3 -passout pass:x -out server.pass.key 2048
  1. write out the RSA private key
  • openssl rsa -passin pass:x -in server.pass.key -out server.key
  1. create the certificate signing request (CSR) for the server or common name;
  • openssl req -new -key server.key -out server.csr -config openssl.cnf -subj "/C=US/ST=TX/L=Allen/O=WatchGuard Video/CN=localhost"
  1. generate the x509 certificate from the request (this certificate will work in Root, but not WebHosting because no private key yet); this is normally handled by certificate CA
  • openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
@Vestride
Vestride / encoding-video.md
Last active April 24, 2024 09:59
Encoding video for the web

Encoding Video

Installing

Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.

brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac --with-opus