Skip to content

Instantly share code, notes, and snippets.

View MaxLazar's full-sized avatar
🤖

Max Lazar MaxLazar

🤖
View GitHub Profile
Sync a folder on server with bucket
s3cmd sync /this/www/ s3://to/this/bucket/
Copy one bucket to another
s3cmd sync s3://from/this/bucket/ s3://to/this/bucket/
http://s3tools.org/download
http://tecadmin.net/install-s3cmd-manage-amazon-s3-buckets/
http://tecadmin.net/s3cmd-file-sync-with-s3bucket/
@MaxLazar
MaxLazar / gist:4929be83057c3a493486
Last active August 29, 2015 14:13
Image optimization
#!/bin/sh
declare -a iPath=('/var/www/vhosts/public_html/images/misc');
lof_file=('/var/www/vhosts/image_opt.log')
start_time=$(date +%s)
if [ -f $lof_file ];
then
dt_mod=("-newer $lof_file")
else
Disable the Dock’s ‘bounce to alert’ behavior
defaults write com.apple.dock no-bouncing -bool TRUE
killall Dock
How tasks works
http://craftcms.stackexchange.com/questions/14530/tasks-and-steps
@MaxLazar
MaxLazar / gist:0193eabf5d3749ed04a05e8f1bb6f1d8
Created August 11, 2016 14:07
Cheat Sheet: craft.entries
{# craft.entries tag #}
{% set entries = craft.entries.first() %}
{% set entries = craft.entries.last() %}
{% set entries = craft.entries.find() %}
{% set entries = craft.entries.ids() %}
{% set entries = craft.entries.total() %}
{% set entries = craft.entries({
id: id OR 'not id' OR '1,2,3' OR [1,2,3],
fixedOrder: true OR false,
@MaxLazar
MaxLazar / robots.txt nginx
Last active March 25, 2024 07:55
Serve robots.txt inline in Nginx
Serve robots.txt inline in Nginx
06/18/2015 nginx 3 Comments
To quickly serve a robots.txt from Nginx without actually having access to the physical file you can define the content of the robots.txt file in the Nginx .conf file.
Allow access to all User-agents:
location /robots.txt {return 200 "User-agent: *\nDisallow:\n";}
Disallow access to every User-agent:
Adyen Test Card Numbers
These cards are only valid on our TEST system and they will never involve any actual transaction or transfer of funds. The TEST card numbers will not work on the Adyen LIVE Platform.
For all cards use the following expiration and CVV2/CVC2/or CID for Amex.
For all cards:
Expiration Dates CVV2 / CVC3 CID (American Express)
06/2016 OR 08/2018 737 7373
cd /etc/ssl/certs
openssl dhparam -out dhparam.pem 4096
Cookies
All cookies should be created such that their access is as limited as possible. This can help minimize damage from cross-site scripting (XSS) vulnerabilities, as these cookies often contain session identifiers or other sensitive information.
Directives
Secure: All cookies must be set with the Secure flag, indicating that they should only be sent over HTTPS
HttpOnly: Cookies that don't require access from JavaScript should be set with the HttpOnly flag
Expiration: Cookies should expire as soon as is necessary: session identifiers in particular should expire quickly
@MaxLazar
MaxLazar / hipchat-v2.sh
Created November 29, 2017 10:37 — forked from danriti/hipchat-v2.sh
HipChat API v2 - Send a message to a room using cURL
#!/bin/bash
# Set the ROOM_ID & AUTH_TOKEN variables below.
# Further instructions at https://www.hipchat.com/docs/apiv2/auth
ROOM_ID=XXX
AUTH_TOKEN=XXX
MESSAGE="Hello world!"
curl -H "Content-Type: application/json" \
curl -w "@curl-format.txt" -o /dev/null -s http://wordpress.com/
n
time_namelookup: %{time_namelookup}n
time_connect: %{time_connect}n
time_appconnect: %{time_appconnect}n
time_pretransfer: %{time_pretransfer}n
time_redirect: %{time_redirect}n
time_starttransfer: %{time_starttransfer}n
----------n