Skip to content

Instantly share code, notes, and snippets.

@huglester
huglester / action.php
Created October 22, 2015 11:24 — forked from JokubasR/action.php
auto zip code
/**
* @author Jokūbas Ramanauskas
* @since 2015-03-26
*
* Fetches postcode by given address information
*
* @return bool
*/
public function getPostCodeByAddress()
{
<?php
/**
* Lietuviškų vardų linksniai.
*
* @author Dainius Kaupaitis <dainius at kaupaitis dot lt>
* @copyright Copyleft (ↄ) 2011, Dainius Kaupaitis
* @version 1.0
* @package Vardai
*/
@huglester
huglester / readme.md
Last active August 29, 2015 14:12
Plesk2Da migration scirpt

Plesk 9.x to DA migration script

To know

  • after migration - you will have to manualy replace mysql credentials

Pre setup

  • make PHP max_execution_time to something like 3600 (1 hour)

Known issues

@huglester
huglester / roundcube_mail_disable_csrf_on_login.php
Last active October 12, 2023 07:31
RoundCube mail - disable CSRF protection on login example
<?php
/*
Install:
1) create a folder: disablecsrf inside 'plugins/' directory.
2) place this file there and name it: disablecsrf.php
3) go to config/config.inc.php, and add it to plugins, like:
$config['plugins'] = array('disablecsrf');
CSRF should now be disabled for login.
*/
@huglester
huglester / test.php
Created October 20, 2014 12:11
test
function youtube_get_id($url)
{
$pattern =
'%^# Match any youtube URL
(?:https?://)? # Optional scheme. Either http or https
(?:www\.)? # Optional www subdomain
(?: # Group host alternatives
youtu\.be/ # Either youtu.be,
| youtube\.com # or youtube.com
Package: libapache2-mod-php5 libapache2-mod-php5filter
Pin: version 5.2*
Pin-Priority: 1001
Package: php5-suhosin
Pin: version 0.9.2*
Pin-Priority: 1001
Package: php5 php5-cgi php5-cli php5-common php5-curl php5-dbg php5-dev php5-enchant php5-gd php5-gmp php5-ming php5-xcache
Pin: version 5.2*
@huglester
huglester / Homestead.yml
Last active August 29, 2015 14:07
Homestead config
---
ip: "192.168.10.10"
memory: 2048
cpus: 2
authorize: D:/ssh_keys/id_rsa.pub
keys:
- D:/ssh_keys/id_rsa
upstream mailcatcher {
sticky;
server appserver.domain.ch:3000 max_fails=1 fail_timeout=2s;
}
server {
listen 80;
server_name mailcatcher.domain.ch;
client_max_body_size 4G;
keepalive_timeout 5;
@huglester
huglester / vhost_add.sh
Created September 8, 2014 15:09
vhost_add.sh
#!/usr/bin/env bash
if [[ -z "$1" ]]; then
echo "example usage: /usr/local/bin/vhost_add.sh acme";
exit;
fi
block="server {
server_name $1.avek.eu;
root /var/www/vhosts/$1/web;
@huglester
huglester / optimizations.conf
Last active August 29, 2015 14:00
MySQL optimizations
[server]
# on SSD do we need it?
tmpdir=/ram/mysql
tmp_table_size=2K
# runtime edit:
#set global net_buffer_length=1000000;
#set global max_allowed_packet=1000000000;
max_allowed_packet=100M