Skip to content

Instantly share code, notes, and snippets.

View webkonstantin's full-sized avatar

Konstantin L webkonstantin

View GitHub Profile
<?php namespace App\Http\Middleware;
use Illuminate\Contracts\Encryption\DecryptException;
use Illuminate\Cookie\Middleware\EncryptCookies as BaseMiddleware;
use Symfony\Component\HttpFoundation\Cookie;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
// The first two functions are identical to the originals in the parent class
// other than the sections marked "MOD". The third function is a new helper
@servers([ 'web' => '[email protected]', 'localhost' => 'localhost' ])
@macro('deploy')
deploy:merge
deploy:assets
deploy:push
deploy:pull
@endmacro
apt-get install --no-install-recommends ca-certificates curl wget
apt-get install -y openjdk-7-jre-headless
gpg --keyserver pool.sks-keyservers.net --recv-keys \
05AB33110949707C93A279E3D3EFE6B686867BA6 \
07E48665A34DCAFAE522E5E6266191C37C037D42 \
47309207D818FFD8DCD3F83F1931D684307A10A5 \
541FBE7D8F78B25E055DDEE13C370389288584E7 \
61B832AC2F1C5A90F0F9B00A1C506407564C17A3 \
@webkonstantin
webkonstantin / swap
Last active December 16, 2015 10:41
add swap file
#!/bin/sh
fallocate -l 2G /swapfile
chmod 600 /swapfile
ls -lh /swapfile
mkswap /swapfile
swapon /swapfile
free -m
@webkonstantin
webkonstantin / post-receive
Last active December 16, 2015 10:39
post-receive example for non-bare repo
#!/bin/bash
set -e
# move to working tree dir
export GIT_DIR=$(cd ${GIT_DIR}; pwd)
GIT_WORK_TREE="${GIT_DIR}/.."
# update working dir
(
<?php
namespace App\Http\Middleware;
use Closure;
use ReflectionMethod;
use ReflectionFunction;
use Illuminate\Database\Eloquent\Model;
class SubstituteImplicitBindings
@webkonstantin
webkonstantin / osx-for-hackers.sh
Created December 1, 2016 01:02 — forked from brandonb927/osx-for-hackers.sh
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx
@webkonstantin
webkonstantin / main.yml
Created December 28, 2018 18:32 — forked from ParagDoke/main.yml
Conditionally loop over multiple ansible tasks
---
- name: test
hosts: localhost
connection: local
tasks:
- name: Invoke poller
vars:
url: http://localhost:8000/abc.json
validate_certs: yes
poll_interval: 10
@webkonstantin
webkonstantin / osx_setup.sh
Created October 21, 2019 13:48 — forked from dannysmith/osx_setup.sh
Sensible defaults for New Mac
#!/usr/bin/env bash
# ~/.osx — http://mths.be/osx
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until `.osx` has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &