Skip to content

Instantly share code, notes, and snippets.


Oozman oozman

View GitHub Profile
oozman / restart.bash
Last active May 21, 2020
Simple script to re-deploy a container via SSH.
View restart.bash
# Usage: ./restart.bash <container-name> <domain name>
# Build
docker build -t $CONTAINER_NAME .
oozman /
Last active May 7, 2020
Get IP of docker containers.
docker inspect -f '{{.Name}} - {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker ps -aq)
oozman /
Created Oct 19, 2018
Random file renamer.
chars=( {a..z} {A..Z} {0..9} )
function rand_string {
local c=$1 ret=
while((c--)); do
printf '%s\n' "$ret"
oozman /
Last active Jan 17, 2020
Exposing HomeAssistant to the Internet

Install Dataplicity

Exposes our RaspberryPi to the web.

  • Login to RaspberryPi
  • Create account at
  • Install Dataplicity daemon as per instruction.
  • Go to your Dataplicity dashboard and go to your device and enable wormhole.

Install Caddy Server

This will serve as our HTTP server.

oozman / vue.js
Created Aug 27, 2017
on-load vue component
View vue.js
Vue.component('onload', {
props: [],
template: '<span></span>',
created: function () {
methods: {
load() {
oozman / directive.js
Last active Aug 18, 2017
View directive.js
* Toast directive. Ex: <toast msg="Some message." style="success|info|warning|danger"></toast>
.directive('toast', [function () {
return {
restrict: 'E',
template: function (elem, attr) {
return '<div class="toast">\n' +
' <div class="{{ style }}" role="alert">{{msg}}</div>\n' +
oozman / miio
Last active Sep 25, 2017
MI Home Integration #api #nodejs
View miio
* Install miio library:
`node install -g miio`
* Get device token:
`miio --discover`
or use [python-mirobo](
* See and follow miio library documentation.
View Run Headless Nightmare.js Scripts
How to install and run Headless nightmare.js based scripts in Ubuntu.
1. Spin Ubuntu 16.04 x64 server
2. Run: apt-get update
3. Run: apt-get upgrade
4. Run: apt-get install -y libgtk2.0-0 libgconf-2-4 libasound2 libxtst6 libxss1 libnss3 xvfb
5. Install Node.js 6+. See:
You can then run your script using this command:
oozman / gist:8e78d465632745fd197eebe95239f176
Created Jul 20, 2016
[js] clean msword special characters
View gist:8e78d465632745fd197eebe95239f176
/// Replaces commonly-used Windows 1252 encoded chars that do not exist in ASCII or ISO-8859-1 with ISO-8859-1 cognates.
var replaceWordChars = function(text) {
var s = text;
// smart single quotes and apostrophe
s = s.replace(/[\u2018\u2019\u201A]/g, "\'");
// smart double quotes
s = s.replace(/[\u201C\u201D\u201E]/g, "\"");
// ellipsis
s = s.replace(/\u2026/g, "...");
// dashes
View Query Log [L5]
function ($sql) {
// To save the executed queries to file:
// Process the sql and the bindings:
foreach ($sql->bindings as $i => $binding) {
if ($binding instanceof \DateTime) {
$sql->bindings[$i] = $binding->format('\'Y-m-d H:i:s\'');
} else {