Skip to content

Instantly share code, notes, and snippets.

@vladkras
vladkras / reload_apache.sh
Created June 12, 2019 03:17
Test config and reload Apache in one command
function reload () {
STATUS=$(sudo apache2ctl configtest 2>&1)
OK=$(echo $STATUS | grep "OK" | wc -l)
if [[ $OK -eq 1 ]]; then
echo "reloading Apache..."
sudo service apache2 reload
else
echo "$STATUS"
LINEOF=$(echo "$STATUS" | grep -Eo "line ([0-9]+) of [^:]+")
if [ ! -z "$LINEOF" ]; then
@vladkras
vladkras / skypeupdate.sh
Created May 30, 2019 05:41
Ubuntu Linux auto update Skype™
#! /bin/bash
DEB_FILE=/tmp/skype.deb
# remove old file if any
rm $DEB_FILE
# get download link
if [ -z "$1" ]; then
DOWNLOAD_LINK=https://go.skype.com/skypeforlinux-64.deb
else
DOWNLOAD_LINK="$1"
@vladkras
vladkras / default.conf
Last active January 17, 2024 09:59
NGINX redirect to app store and google play based on user agent
location = /gotoapp {
if ($http_user_agent ~* "iphone|ipod|ipad|appletv") {
return 301 https://www.apple.com/lae/ios/app-store/;
}
if ($http_user_agent ~* "android") {
return 301 https://play.google.com/store;
}
if ($http_user_agent ~* "Windows") {
return 301 https://www.microsoft.com/store/apps?rtc=1;
/*
* FancyBox - jQuery Plugin
* Simple and fancy lightbox alternative
*
* Examples and documentation at: http://fancybox.net
*
* Copyright (c) 2008 - 2010 Janis Skarnelis
* That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
*
* Version: 1.3.4 (11/11/2010)
@vladkras
vladkras / jquery.arise-0.1.1.js
Last active December 17, 2015 03:58
aRise - simple lightbox, fancybox & other gallery popups alternative. All in one file: no css and image files for controls. Only jQuery needed.
(function($) {
"use strict";
$.fn.aRise = function() {
// vars first of all
var links = this, total = this.length;
// add styles to head
$('head').append('<style type="text/css">#arise-div{position:absolute;top:20%;left:50%;cursor:pointer;background-color:#fff;border:1px #aaa solid;padding:2px 4px;border-radius:4px;}</style>');
links.each(function(index) {
$(this).click(function(e) {
e.preventDefault();
@vladkras
vladkras / jquery.easlyder-0.1.js
Created May 2, 2013 00:13
eaSlyder - fast super lightweight jQuery based slider
(function( $ ) {
$.fn.eaSlyder = function( millisec ) {
var $this = this, total = $this.length, cur = 0, timeout = millisec || 4000;
this.each(function(index) {
if (index) $(this).hide();
});
setInterval(function() {
$this.eq(cur).fadeOut(function() {
cur = ( cur == total-1 ) ? 0 : cur+1;
$this.eq(cur).fadeIn();