Skip to content

Instantly share code, notes, and snippets.

View landsman's full-sized avatar

Michal Landsman landsman

View GitHub Profile
@landsman
landsman / ec2-root-resize.sh
Created December 3, 2018 19:25 — forked from kshcherban/ec2-root-resize.sh
ec2 root volume resize
#!/bin/bash -e
if [ $# -ne 2 ]; then
echo "Usage: $0 <instance-id> <volume-size-gb> [PARITION_NAME=/dev/xvda2]"
exit 2
fi
sudo apt-get install jq -y
@landsman
landsman / .gitlab-ci.yml
Created October 11, 2018 09:40
Pristupy v settings projektu nastavit jako secured value
stages:
- deploy
build:
stage: deploy
environment:
name: production
image: mwienk/docker-lftp:latest
script:
- mv .htaccess-dist .htaccess
-- Adminer 4.6.3 PostgreSQL dump
DROP TABLE IF EXISTS "venues";
DROP SEQUENCE IF EXISTS venues_id_seq;
CREATE SEQUENCE venues_id_seq INCREMENT 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1;
CREATE TABLE "public"."venues" (
"id" integer DEFAULT nextval('venues_id_seq') NOT NULL,
"phone_number" text NOT NULL,
"name" text NOT NULL,
<IfModule mod_rewrite.c>
RewriteEngine On
# fix one domain name with HTTPS
#
RewriteCond %{HTTP_HOST} ^studioartcz.cz [NC]
RewriteRule ^(.*)$ https://www.studioart.cz/$1 [L,R=301]
# fix for poor hosting without www_root setup
#
@landsman
landsman / start.sh
Created June 25, 2018 07:51
todo: check environment for javabox
#!/bin/bash
# check environment
UNAME=$(uname)
if [[ "$UNAME" == "Linux" ]] ; then
echo "Okay, you have Linux, everything should be fine."
elif [[ "$UNAME" == "Darwin" ]] ; then
echo "Warning for MacOS user: This JavaBox is tested only on Ubuntu Linux."
elif [[ "$UNAME" == CYGWIN* || "$UNAME" == MINGW* ]] ; then
@landsman
landsman / createhost.sh
Created May 14, 2018 12:26
ubuntu virtualhost quick scripts
#!/bin/bash
echo "Enter the VirtualHost name : "
read name
echo "Enter the VirtualHost root [/var/www/html/] : "
read root
if [ -d "/var/www/html/"$root ]
then
if [ -w /etc/hosts ]
echo "creating apache virtial host..."
@landsman
landsman / tabs.js
Last active May 8, 2018 09:12
vanilla javascript tabs / switch content visibility
/**
* @todo: remove e argument somehow
* @param e this - context
* @param elementId - target element id
*/
function switchContent(e, elementId)
{
var another_links = e.parentNode.children;
for(var l = 0; l < another_links.length; l++)
{
class Sidebar {
constructor(c)
{
this.burger = document.getElementById(c.burger_id);
this.sidebar = document.getElementById(c.sidebar_id);
this.close = document.getElementById(c.close_id);
this.sidebar_open = c.sidebar_open_class;
this.body_sidebar_open = c.body_sidebar_open;
this.is_open = false;
let gulp = require('gulp'),
replace = require('gulp-batch-replace'),
filesExist = require('files-exist');
gulp.task('bt4', () =>
{
let diff = {
'@media (min-width: $screen-xs-min) and (max-width: $screen-sm-max)': '@media (min-width: map-get($grid-breakpoints, xs)) and (max-width: map-get($grid-breakpoints, xs))',
'@media (min-width: $screen-xs) and (max-width: ($screen-md-min - 1))': '@media (min-width: map-get($grid-breakpoints, xs)) and (max-width: map-get($grid-breakpoints, md)-1)',
@landsman
landsman / csv.php
Created November 6, 2017 18:49
CSV to associative array
<?php
class RandomClass
{
/**
* Convert a comma separated file into an associated array.
* The first row should contain the array keys.
*
* Example: