Skip to content

Instantly share code, notes, and snippets.

@x86demon
x86demon / sysctl.conf
Last active August 29, 2015 14:18
Linux swap optimize
vm.laptop_mode = 5
vm.dirty_writeback_centisecs = 6000
vm.swappiness=1
vm.vfs_cache_pressure=50
fs.inotify.max_user_watches = 524288
@x86demon
x86demon / tricky.php
Created February 23, 2016 14:39
tricky.php
<?php
$a = [1, 2, 3];
unset($a[1]);
for ($i = 0; $i < count($a); $i++) {
echo $a[$i];
}
$b = [1.1 => 1, 1.2 => 2, 1.3 => 3];
var_dump($b);
@x86demon
x86demon / fastcgi_params
Last active June 24, 2024 19:58
nginx server config for monolitic repo
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
@x86demon
x86demon / oro_reinstall.sh
Last active June 24, 2024 19:58
Oro Reinstall script
#!/bin/bash
currentDir=${PWD##*/}
repoDir=$(basename $(dirname $(dirname $(readlink -f .))))
APP_CONSOLE="bin/console"
CONFIG_DIR="config"
CACHE_DIR="var/cache"
APP_NAME="ORO"
ENV=$1
@x86demon
x86demon / Campaign + Leads + Opportunities.sql
Last active July 24, 2023 09:27
PostgreSQL entities generators
CREATE OR REPLACE FUNCTION insertLeadsOpportunities(campaigns INT, leads INT)
RETURNS INT AS
$$
DECLARE
campaignId INTEGER;
leadId INTEGER;
BEGIN
FOR i IN 1 .. campaigns
LOOP
-- INSERT call
[ 0.000000] Booting Linux on physical CPU 0x500
[ 0.000000] Linux version 4.12.0-rc6-The-Twelve-MyyQi+ (gamer@tachibana) (gcc version 5.4.0 (Gentoo 5.4.0 p1.0, pie-0.6.5) ) #3 SMP PREEMPT Tue Jun 20 03:38:14 UTC 2017
[ 0.000000] CPU: ARMv7 Processor [410fc0d1] revision 1 (ARMv7), cr=10c5387d
[ 0.000000] CPU: div instructions available: patching division code
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] OF: fdt: Machine model: Rockchip RK3288 Tinker Board
[ 0.000000] Memory policy: Data cache writealloc
[ 0.000000] On node 0 totalpages: 524288
[ 0.000000] free_area_init_node: node 0, pgdat c13e1800, node_mem_map eeff9000
[ 0.000000] Normal zone: 1536 pages used for memmap
@x86demon
x86demon / apache.conf
Created July 7, 2017 08:40
WSS clank
<VirtualHost *:8080>
ServerName %HTTP_HOSTNAME%
SSLEngine on
SSLCertificateFile "%HTTP_SSL_CRT%"
SSLCertificateKeyFile "%HTTP_SSL_KEY%"
RewriteEngine On
RewriteCond %{HTTP:Connection} Upgrade [NC]
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteRule .* ws://%WS_TARGET_IP%:8080%{REQUEST_URI} [P,L]
ProxyPreserveHost On
@x86demon
x86demon / category.csv
Last active July 14, 2017 16:49
OroNeo Review
code label-en_US parent
master Master catalog
cat_11 Category 1.1 master
cat_111 Category 1.1.1 cat_11
cat_12 Category 1.2 master
#!/bin/bash
currentDir=${PWD##*/}
repoDir=$(basename $(dirname $(dirname $(readlink -f .))))
APP_HOST=$currentDir.$repoDir.loc
APP_CONSOLE="app/console"
INDEX="app_dev.php"
if [[ ! -f ${APP_CONSOLE} ]]
then
@x86demon
x86demon / oro_db
Last active June 24, 2024 19:58
Small script for dump/restore database
#!/bin/bash
APP_CONSOLE="bin/console"
CONFIG_DIR="config"
ENV=""
if [[ $2 == 'test' ]]
then
ENV='_test'
fi