Skip to content

Instantly share code, notes, and snippets.

View wellic's full-sized avatar

Valerii Savchenko wellic

View GitHub Profile
# Redirection of port 80 to port 443
<virtualhost *:80>
ServerName redmine.domain.com
KeepAlive Off
RewriteEngine On
#RewriteCond %{HTTP_HOST} ^[^\./]+\.[^\./]+$
RewriteRule ^/(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
@wellic
wellic / gitcomenu.sh
Created June 6, 2016 16:21 — forked from alecthegeek/gitcomenu.sh
Make `git checkout <branch>` into a menu selection
OPS3=$PS3
echo There are multiple branchs in this repo. Please select the one you want to use
PS3='If you're not sure just choose "master" '
select br in $(git branch|sed -e '/^[* ] /s///'); do
[[ -n $br ]] && git checkout $br &&
break
done
PS3=$OPS3
@wellic
wellic / screenshot-to-dropbox.sh
Created July 6, 2016 12:55 — forked from Ajnasz/screenshot-to-dropbox.sh
Create screenshot to dropbox folder and copy it's dropbox link to clipboard
#!/bin/sh
DISPLAY=:0.0
DROPBOXPYPATH=/usr/bin/dropbox
XCLIP=/usr/bin/xclip
FILENAME=`date +shot-%Y-%m-%d-%H%M%S.png`
FULLPATH=$HOME/Dropbox/Public/Screenshots/$FILENAME
import -window root $FULLPATH
# Before Script
before_script:
- composer self-update
- composer install --prefer-dist > /dev/null
- cp .env.example .env
- php artisan key:generate
- php artisan migrate:refresh
# Services
services:
@wellic
wellic / .eslint.json
Created November 24, 2016 17:16 — forked from JoshTheWanderer/.eslint.json
A rough linting boilerplate
{
"extends": "airbnb",
"plugins": [
"react"
],
"env": {
"es6": true
},
"parserOptions": {
"ecmaVersion": 6,
@wellic
wellic / c_xdebug.sh
Last active May 12, 2017 12:21
Debuging console php application from docker container
#!/bin/sh
SERVER_NAME=localhost \
SERVER_PORT=80 \
XDEBUG_CONFIG="PHPSTORM" \
php -dxdebug.remote_host=`ip r | grep default | awk '/default/{print $3}'` \
$@
#Usage in the docker:
#c_xdebug.sh script.php
@wellic
wellic / telegram-installer.sh
Created May 22, 2017 09:21 — forked from kobylyanets/telegram-installer.sh
telegram-installer.sh
#!/bin/bash
echo "============================================="
echo "== Telegram Script Installer =="
echo "== =="
echo "== for www.LinuxRussia.com =="
echo "============================================="
echo "Downloading necesary files..."
cd /tmp
@wellic
wellic / changeValueDetection.js
Created August 28, 2017 23:50 — forked from inter-coder/changeValueDetection.js
changeValueDetection - Observer
HTMLElement.prototype.changeValueDetection = function(){
var element=this;
var oldVal=element.value;
var GUID = function (){var S4 = function () {return(Math.floor(Math.random() * 0x10000).toString(16));};return (S4() + S4() + "-" +S4() + "-" +S4() + "-" +S4() + "-" +S4() + S4() + S4());};
var uiq="GUID-"+GUID();
if(window.changeValueDetectionEvents==undefined)window.changeValueDetectionEvents=new Event('changeValueDetection');
element.setAttribute("data-uiq",uiq);
window[uiq]=setInterval(function(){
if(element.value!=oldVal){
oldVal=element.value;element.setAttribute("value",oldVal);
@wellic
wellic / Django + Ajax dynamic forms .py
Created September 19, 2017 09:39 — forked from goldhand/Django + Ajax dynamic forms .py
Django form with Ajax. A simple Task model that can be updated using a CBV with an AJAX mixin. The view sends post data with ajax then updates the view with a callback to a DetailView with a json mixin.There is an abstract CBV, AjaxableResponseMixin, based on the example form django docs, that is subclassed in the TaskUpdateView CBV. TaskUpdateV…
#models.py
class Task(models.Model):
title = models.CharField(max_length=255)
description = models.TextField()
def __unicode__(self):
return self.title
@wellic
wellic / convert_float.py
Last active September 26, 2019 13:19
Convert float and Normilize string for converting
import re
import unicodedata
import chardet
def replace_some_unicode_chars(frac_str):
try:
if isinstance(frac_str, str):
frac_str = frac_str.replace("⁄", "/")
frac_str = frac_str.replace("×", "x")