Skip to content

Instantly share code, notes, and snippets.

View MikSDigital's full-sized avatar
🎯
Focusing

Mikhail MikSDigital

🎯
Focusing
View GitHub Profile
@MikSDigital
MikSDigital / main.go
Created December 5, 2022 15:00 — forked from mickelsonm/main.go
Golang program to lookup stocks by symbols using Yahoo Finance API.
package main
import (
"encoding/json"
"encoding/xml"
"fmt"
"io/ioutil"
"net/http"
"net/url"
)
@MikSDigital
MikSDigital / ffcapture
Created December 1, 2022 12:58 — forked from seanbutnotheard/ffcapture
FFMPEG Screen capture/stream script
#!/bin/bash
#LICENSE
#To the extent possible under law, the author(s) have dedicated all
#copyright and related and neighboring rights to this software to the
#public domain worldwide. This software is distributed without any warranty.
#See <http://creativecommons.org/publicdomain/zero/1.0/>.
# ffcapture, a hacky script to stream/capture your desktop or a window
# REQUIRES ffmpeg, xwininfo and bc to be installed!
@MikSDigital
MikSDigital / mysql-docker.sh
Created September 3, 2020 13:07 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@MikSDigital
MikSDigital / tz.js
Last active January 9, 2020 08:36
get timezone string
function getTimeZoneString() {
var abbr = "";
try {
abbr = new Intl.DateTimeFormat().resolvedOptions().timeZone;
} catch (e) {
abbr = ""
}
return abbr || "";
@MikSDigital
MikSDigital / run.sh
Created September 16, 2019 07:15
stop apache if conflict with docker
sudo /etc/init.d/apache2 stop
@MikSDigital
MikSDigital / Dockerfile
Created September 1, 2019 16:33
Dockerfile for gatsby.js development
FROM node:10-alpine
RUN apk update && \
apk add --update --repository http://dl-3.alpinelinux.org/alpine/edge/community vips-tools vips-dev fftw-dev gcc g++ make libc6-compat && \
apk add git && \
apk add python && \
rm -rf /var/cache/apk/*
#RUN git config --global url."https://github.com/".insteadOf "[email protected]:"
RUN git config --global user.email "[email protected]"
<?php
namespace Firebase\JWT;
use \DomainException;
use \InvalidArgumentException;
use \UnexpectedValueException;
use \DateTime;
/**
* JSON Web Token implementation, based on this spec:
@MikSDigital
MikSDigital / run.sh
Created July 3, 2019 06:31
run docker node.js image inside folder to map local folders into docker container
docker run -it --rm -u $(id -u ${USER}):$(id -g ${USER}) -v ${PWD}:/app node:11 /bin/sh
@MikSDigital
MikSDigital / index.html
Created April 8, 2019 05:44 — forked from jazzido/index.html
Webcam barcode reading (zbar, emscripten)
<!DOCTYPE html>
<html>
<head>
<title>JS in-browser barcode reader</title>
<style type="text/css">
body > div {
position: relative;
width: 320px; height: 240px;
}
video { position: absolute; top: 0; left: 0; width: 320px; height: 240px; }
<?php
define('SLACK_WEBHOOK', 'https://hooks.slack.com/services/xxx/yyy/zzz');
function slack($txt) {
$msg = array('text' => $txt);
$c = curl_init(SLACK_WEBHOOK);
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($c, CURLOPT_POST, true);
curl_setopt($c, CURLOPT_POSTFIELDS, array('payload' => json_encode($msg)));
curl_exec($c);