Skip to content

Instantly share code, notes, and snippets.

View tvaliasek's full-sized avatar

Tomáš Valiašek tvaliasek

View GitHub Profile
@tvaliasek
tvaliasek / nats-install.sh
Created November 27, 2023 19:33
Install nats.io server cluster node on rhel clone
#!/bin/bash
cd /tmp
wget https://github.com/nats-io/nats-server/releases/download/v2.10.5/nats-server-v2.10.5-amd64.rpm
yum install -y /tmp/nats-server-v2.10.5-amd64.rpm
rm -rf /tmp/nats-server-v2.10.5-amd64.rpm
useradd -U -M -r -s /sbin/nologin nats
mkdir -p /var/nats
mkdir -p /etc/nats/ssl
cat <<EOF > /etc/nats/nats-server.conf
@tvaliasek
tvaliasek / nextras.tempusdominus.init.js
Last active January 17, 2019 13:57
Nextras Forms tempus dominus datetime picker init
/**
* This file is part of the forked Nextras community extensions of Nette Framework
*
* @license MIT
* @link https://github.com/nextras/forms
* @author Jan Skrasek
* @author Tomas Valiasek
*/
// main init function, function is appended to $.fn
@tvaliasek
tvaliasek / gulpfile.js
Created January 15, 2019 22:33
Gulp 4 - PostCSS wait for SASS compiler to write output files (File not found with singular glob)
/*
After migration to Gulp 4 and rewrite of gulpfile I have found out that gulp-sass plugin cannot
write compiled css files to disk before his task is resolved, even if the task is run in series()
call, causing unmatched glob pattern error. Usage of src(globs, { allowEmpty: true }) is not a
solution, because task must be run twice in order to output correct file.
..after few hours of despair and googling
*/
const { series, dest, src } = require('gulp')
@tvaliasek
tvaliasek / recaptcha.invisible.ajax.js
Last active October 24, 2022 12:38
AJAX invisible recaptcha for uestla/recaptchacontrol
/**
* This file is part of the ReCaptchaControl package
*
* !!! needs polyfill for FormData in IE11 and Edge !!!
* https://github.com/jimmywarting/FormData
*
* @license MIT
* @author Petr Kessler (https://kesspess.cz)
* @link https://github.com/uestla/ReCaptchaControl
*/
@tvaliasek
tvaliasek / ADClient.js
Last active March 30, 2022 18:40
node activedirectory - check if user is locked, disabled or expired and get date of last password change
/*
To get some attributes from AD, you need to set the correct permissions on the container
or object you are trying to read. (e.g., pwdLastSet, userAccountControl)
*/
const ActiveDirectory = require('activedirectory')
/* eslint-disable-next-line no-unused-vars */
const SCRIPT_FLAG = 0
const ACCOUNTDISABLE_FLAG = 1
/* eslint-disable-next-line no-unused-vars */
@tvaliasek
tvaliasek / .htaccess
Created July 10, 2018 15:35
htaccess expire headers and gzip compression
# enable gzip compression
<IfModule mod_deflate.c>
<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript text/javascript application/javascript application/json
</IfModule>
</IfModule>
# ----------------------------------------------------------------------
# Expires headers (for better cache control)
# ----------------------------------------------------------------------
@tvaliasek
tvaliasek / main.js
Created June 5, 2018 20:09
electron axios stream download with progress
import {ipcMain} from 'electron'
const fs = require('fs')
const axios = require('axios')
/* ... */
ipcMain.on('downloadFile', function (event, data) {
const filePath = data.filePath
const item = data.item
<?php
namespace App\Model;
use Nette,
Nette\Utils\Strings,
Nette\Database\Connection;
class GopayAPI extends Nette\Object {
@tvaliasek
tvaliasek / .htaccess
Created June 28, 2016 20:37 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@tvaliasek
tvaliasek / _awesomplete.scss
Created May 27, 2016 10:16
SCSS partial for styling awesomplete.js autocomplete plugin
$aw_list_bg_color: $white;
$aw_list_border: none;
$aw_list_shadow: .05em .2em .6em rgba(0,0,0,.2);
$aw_list_radius: 0px;
$aw_list_color: $darkGray;
$aw_selected_item_bg: $blue;
$aw_selected_item_color: $white;
$aw_mark_bg: $lightBlue;
$aw_mark_color: $white;
$aw_selected_mark_bg: rgba($white, 0.15);