Skip to content

Instantly share code, notes, and snippets.

@ansulev
ansulev / Optimizations_Artix.md
Created April 8, 2023 05:21 — forked from themagicalmammal/Optimizations_Artix.md
Set of optimizations, I use on my Artix Setup
@ansulev
ansulev / security.conf
Created May 1, 2022 06:59 — forked from ambroisemaupate/security.conf
Nginx CSP example
# config to don't allow the browser to render the page inside an frame or iframe
# and avoid clickjacking http://en.wikipedia.org/wiki/Clickjacking
# if you need to allow [i]frames, you can use SAMEORIGIN or even set an uri with ALLOW-FROM uri
# https://developer.mozilla.org/en-US/docs/HTTP/X-Frame-Options
add_header X-Frame-Options SAMEORIGIN;
# when serving user-supplied content, include a X-Content-Type-Options: nosniff header along with the Content-Type: header,
# to disable content-type sniffing on some browsers.
# https://www.owasp.org/index.php/List_of_useful_HTTP_headers
# currently suppoorted in IE > 8 http://blogs.msdn.com/b/ie/archive/2008/09/02/ie8-security-part-vi-beta-2-update.aspx
@ansulev
ansulev / mysql.txt
Created October 11, 2021 05:39 — forked from sarvar/mysql.txt
Changing WordPress URLs in MySQL Database
UPDATE wp_options SET option_value = replace(option_value, 'oldurl.com', 'newurl.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'oldurl.com','newurl.com');
UPDATE wp_posts SET post_content = replace(post_content, 'oldurl.com', 'newurl.com');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'oldurl.com','newurl.com');
@ansulev
ansulev / install-python-2.7.17.sh
Last active July 21, 2024 11:36 — forked from pigeonflight/install-python-2.7.14.sh
Install Python 2.7.17 on Ubuntu 14.04
# usage
# bash install-python-2.7.17.sh
sudo apt-get update
sudo apt-get install build-essential checkinstall -y
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev -y
cd /usr/src
sudo wget https://www.python.org/ftp/python/2.7.17/Python-2.7.17.tgz
sudo tar xzf Python-2.7.17.tgz
cd Python-2.7.17
sudo ./configure --enable-optimizations
@ansulev
ansulev / install-photoshop-cs6.md
Last active August 10, 2024 18:07 — forked from romuloctba/readme.md
Install Adobe Photoshop CS6 on Wine (Arch Linux)

Step 1. Install the Wine and Winetricks

  sudo pacman -S wine winetricks

Step 2. Using winetricks to get install dependencies for Photoshop CS6

winetricks atmlib gdiplus msxml3 msxml6 vcrun2005 vcrun2005sp1 vcrun2008 ie6 fontsmooth-rgb gecko
@ansulev
ansulev / nginx.conf
Created February 15, 2019 06:32 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@ansulev
ansulev / prestashop.conf
Created September 30, 2018 17:01 — forked from julienbourdeau/prestashop.conf
PrestaShop Nginx Configuration
server {
listen 80;
listen [::]:80; #Use this to enable IPv6
server_name www.example.com;
root /var/www/prestashop17;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
index index.php index.html;
@ansulev
ansulev / nginx-ps-config
Created September 30, 2018 09:01 — forked from ASergey/nginx-ps-config
Example prestashop 1.6 nginx host config
server {
listen 80;
server_name maxmobiles.lo *.maxmobiles.lo;
root /var/www/maxmobiles.lo;
error_log /var/www/maxmobiles.lo/log/error.log warn;
location / {
index index.html index.php; ## Allow a static html file to be shown first
@ansulev
ansulev / sql2csv
Created June 27, 2018 17:16 — forked from mtth/sql2csv
Parse SQL dump into csv.
#!/usr/bin/env bash
# convert sql dumps to csv, tsv, ssv...
# also can filter fields using a sed pattern
# only works on linux
function usage
{
echo "usage: $0 [-sc CORES] [-o OUTFILE] [-p PATTERN] SQLFILE" 2>&1 && exit 1
}
@ansulev
ansulev / wp-maintenance-mode.php
Last active July 7, 2018 07:24 — forked from digitalinkwell/maintenance-mode.php
Easy put WordPress in Maintenance Mode.
/*
* put this on the very bottom of the functions.php file of your theme
* or create manually .maintenance on your web root with desired message
*/
// Activate WordPress Maintenance Mode
function wp_maintenance_mode(){
if(!current_user_can('edit_themes') || !is_user_logged_in()){
wp_die('<h1 style="color:red">Website under Maintenance</h1><br />We are performing scheduled maintenance. We will be back online shortly!');
}