Skip to content

Instantly share code, notes, and snippets.

//https://habr.com/post/213515/
// This works on all devices/browsers, and uses IndexedDBShim as a final fallback
var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB,
IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction || window.msIDBTransaction,
baseName = "baseName",
storeName = "storeName";
function logerr(err){
console.log(err);
@bspavel
bspavel / index.html
Last active May 4, 2018 16:13
Add jQuery function to specific elements
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="//code.jquery.com/jquery-3.3.1.min.js"></script>
<title></title>
<script type="text/javascript">
$(function(){
$.fn.Myfunc = function(){
this.each(function(){
var className = $(this).attr('class');
@bspavel
bspavel / download-and-install.sh
Created July 8, 2018 10:55 — forked from andrius/download-and-install.sh
Script to download and install Asterisk PBX, Ruby and Adhearsion AGI on debian-based system
#!/bin/bash
# function to generate random password, on input requires an argument - lenght of password
genpasswd() {
local l=$1
[ "$l" == "" ] && l=20
tr -dc A-Za-z0-9_ < /dev/urandom | head -c ${l} | xargs
}
# MySQL default root password
@bspavel
bspavel / query-string-example.js
Created July 12, 2018 08:11 — forked from sindresorhus/query-string-example.js
Get, set, modify url parameters in a query string with JavaScript.
// Get the queryString module from:
// https://github.com/sindresorhus/query-string
console.log(location.href);
// http://sindresorhus.com/?foo=bar
console.log(location.search);
// ?foo=bar
var parsed = queryString.parse(location.search);
@bspavel
bspavel / guacamole.sh
Last active July 13, 2018 09:45
Guacamole installer
#!/bin/bash
if [ "$(whoami)" != "root" ]; then
echo "Run script as ROOT please. (sudo !!!)"
exit
fi
# ------------------------------
if [ -z "$JAVA_HOME" ]; then
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
@bspavel
bspavel / guacamole-install-script.sh
Created July 13, 2018 12:16
guacamole installer for CentOS
#!/bin/env bash
##############################################################
# This script was created by Hernan Dario Nacimiento based on:
# http://guacamole.incubator.apache.org/releases/0.9.13-incubating/
# http://guacamole.incubator.apache.org/doc/0.9.13-incubating/gug/
# http://guacamole.incubator.apache.org/doc/0.9.13-incubating/gug/administration.html
# http://nginx.org/en/docs/http/configuring_https_servers.html
# http://nginx.org/en/docs/http/ngx_http_spdy_module.html
# https://wiki.centos.org/AdditionalResources/Repositories
# Task of this script:
@bspavel
bspavel / nextcloud_installer.sh
Last active August 15, 2018 16:58
the installer of the nextcloud on the raspberry pi
#!/bin/bash
#https://pimylifeup.com/raspberry-pi-nextcloud-server/
#https://stackoverflow.com/questions/13322485/how-to-get-the-primary-ip-address-of-the-local-machine-on-linux-and-os-x
#https://unix.stackexchange.com/questions/293940/bash-how-can-i-make-press-any-key-to-continue
#https://stackoverflow.com/questions/638975/how-do-i-tell-if-a-regular-file-does-not-exist-in-bash
#https://www.cyberciti.biz/faq/bash-infinite-loop/
#https://stackoverflow.com/questions/2379829/while-loop-to-test-if-a-file-exists-in-bash
if [ "$(whoami)" != "root" ]; then
@bspavel
bspavel / apache_guacamole_installer.sh
Last active July 5, 2019 22:42
the installer of the apache guacamole on the raspberry pi
#!/bin/bash
#http://www.m-opensolutions.com/?p=936
if [ "$(whoami)" != "root" ]; then
echo "Run script as ROOT please. (sudo !!!)"
exit
fi
# Disable Wi-Fi and Bluetooth
@bspavel
bspavel / print_server_installer.sh
Last active March 24, 2020 08:24
the installer of the print server on the raspberry pi
#!/bin/bash
#http://www.ekzorchik.ru/2017/09/print-server-cups-on-raspberry-pi-3/
#https://habrahabr.ru/post/328576/
#https://wiki.debian.org/ru/HowTo/ChangeHostname
#http://help.ubuntu.ru/wiki/сканеры_решение_общих_проблем_с_подключением
#http://www.sane-project.org/sane-mfgs.html#Z-CANON
#https://feeding.cloud.geek.nz/posts/setting-up-a-network-scanner-using-sane/
#https://wiki.contribs.org/SANE
#https://dev.shyd.de/2011/03/debian-printserver-scanserver-hplip-cups-sane/
@bspavel
bspavel / scan_server_installer.sh
Last active August 17, 2018 18:42
the installer of the scan server on the raspberry pi
#!/bin/bash
#https://feeding.cloud.geek.nz/posts/setting-up-a-network-scanner-using-sane/
#https://askubuntu.com/questions/762702/failed-to-start-saned-service-unit-saned-service-is-masked
#http://www.ekzorchik.ru/2017/09/print-server-cups-on-raspberry-pi-3/
#https://habrahabr.ru/post/328576/
#https://wiki.debian.org/ru/HowTo/ChangeHostname
#http://help.ubuntu.ru/wiki/сканеры_решение_общих_проблем_с_подключением
#http://www.sane-project.org/sane-mfgs.html#Z-CANON
#https://feeding.cloud.geek.nz/posts/setting-up-a-network-scanner-using-sane/