Skip to content

Instantly share code, notes, and snippets.

View nntoan's full-sized avatar
🌀

Toan Nguyen nntoan

🌀
View GitHub Profile
@nntoan
nntoan / Varnish VCL Basic Authentication.md
Created August 1, 2021 13:11 — forked from Integralist/Varnish VCL Basic Authentication.md
[Varnish VCL Basic Authentication] #security #basicauth #authentication #vcl #varnish #fastly #cdn

generate a username/password

echo -n beep:boop | base64

YmVlcDpib29w

Note: it's important to use -n otherwise echo will add a line break and that can be a time consuming error to debug when you find your username/password isn't working ;-) if you do find you need to debug, then use curl with the -v flag and inspect the request headers being sent and make sure your base64 encoded username/password matches what curl generates for the Authorization header when using the --user flag (see below curl examples)

@nntoan
nntoan / purge.sh
Created December 21, 2017 06:25 — forked from adrienbrault/purge.sh
Script to reduce VM size before packaging for vagrant
#!/bin/sh
# Credits to:
# - http://vstone.eu/reducing-vagrant-box-size/
# - https://github.com/mitchellh/vagrant/issues/343
aptitude -y purge ri
aptitude -y purge installation-report landscape-common wireless-tools wpasupplicant ubuntu-serverguide
aptitude -y purge python-dbus libnl1 python-smartpm python-twisted-core libiw30
aptitude -y purge python-twisted-bin libdbus-glib-1-2 python-pexpect python-pycurl python-serial python-gobject python-pam python-openssl libffi5
@nntoan
nntoan / update_emails.sql
Created March 23, 2016 07:38 — forked from antoinekociuba/update_emails.sql
Update customer/order email addresses in test environment database (prevent to accidentally send test emails to real customers)
## Update order email addresses ##
UPDATE `sales_flat_order`
SET `customer_email` = CONCAT('test__', `customer_email`)
WHERE `customer_email` NOT IN ('[email protected]', '[email protected]')
AND `customer_email` NOT LIKE 'test__%';
## Update customer email addresses ##
UPDATE `customer_entity`
SET `email` = CONCAT('test__', `email`)
WHERE `email` NOT IN ('[email protected]', '[email protected]')
@nntoan
nntoan / disable_enable_ee_index.php
Created March 23, 2016 07:37 — forked from antoinekociuba/disable_enable_ee_index.php
Disable/Enable EE index updates (might be useful during a script execution to speed it up...)
<?php
/**********************
****** DISABLE *******
**********************/
/** var Mage_Core_Model_Config $config */
$config = Mage::app()->getConfig();
/**
@nntoan
nntoan / full_reindex.php
Created March 23, 2016 07:37 — forked from antoinekociuba/full_reindex.php
Magento full reindex script (EE compatible)
<?php
/** Full reindex script */
/**
* @var array
*/
$processes = array();
/**
* @var Mage_Core_Model_Factory $factory
@nntoan
nntoan / customers.sql
Created March 23, 2016 07:37 — forked from leek/_Magento1_DeleteTestData.md
Magento - Delete All Test Data
SET FOREIGN_KEY_CHECKS=0;
-- Customers
TRUNCATE `customer_address_entity`;
TRUNCATE `customer_address_entity_datetime`;
TRUNCATE `customer_address_entity_decimal`;
TRUNCATE `customer_address_entity_int`;
TRUNCATE `customer_address_entity_text`;
TRUNCATE `customer_address_entity_varchar`;
TRUNCATE `customer_entity`;
@nntoan
nntoan / make-flashlight-work-on.yosemite.md
Last active August 29, 2015 14:26 — forked from selaromi/make-flashlight-work-on.yosemite.md
Steps to make Flashlight work on 10.10.4 (doesn't work for El Capitan)

Make Flashlight work on 10.10.4

  1. Install SIMBL http://culater.net/software/SIMBL/SIMBL.php
  2. Copy SpotlightSIMBL.bundle to /Library/Application Support/SIMBL/Plugins/ (a)
  3. Copy Flashlight.osax to ~/Library/ScriptingAdditions/ (b)
  4. Disable Flashlight
  5. Enable Flashlight
  6. Open Script Editor on your Mac (look for "Script Editor In Spotlight") and paste the following code (don't change Snow Leopard for Yosemite)
tell application "Spotlight" to inject SIMBL into Snow Leopard
@nntoan
nntoan / hhvm.hdf
Last active August 29, 2015 14:20 — forked from bearlikelion/hhvm.hdf
# hhvm --mode daemon -vServer.Type=fastcgi -vServer.Port=9001 --config /etc/hhvm.hdf
PidFile = /var/run/hhvm.pid
ServerVariables {
ENVIRONMENT = DEVELOPMENT
}
Log {
UseLogFile = true
@nntoan
nntoan / nginx.conf
Last active August 29, 2015 14:20 — forked from bearlikelion/nginx.conf
server {
listen *:80;
server_name mark.dev;
root /home/mark/dev/src/public;
index index.php;
location / {
# rewrite URL to remove trailing forward slash /
rewrite ^/(.*)/$ /$1 permanent;
using System;
using System.Collections.Generic;
using System.Linq;
using AwesomiumSharp;
using System.Threading;
namespace Automation
{
class AutomationSample
{