Skip to content

Instantly share code, notes, and snippets.

@Hailong
Hailong / default.vcl
Last active July 9, 2022 10:41
Varnish 4 VCL for Prestashop 1.6 (*** This is still under development, don't use it directly! ***)
#
# This is an example VCL file for Varnish.
#
# It does not do anything by default, delegating control to the
# builtin VCL. The builtin VCL is called when there is no explicit
# return statement.
#
# See the VCL chapters in the Users Guide at https://www.varnish-cache.org/docs/
# and https://www.varnish-cache.org/trac/wiki/VCLExamples for more examples.
@Hailong
Hailong / iterm2-solarized.md
Created December 23, 2021 20:59 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@Hailong
Hailong / a-server.go
Created November 15, 2021 23:22 — forked from vomnes/a-server.go
Minimalist TCP server/client in Go using only syscalls - Select() to handle file descriptors
package main
import (
"fmt"
"log"
"golang.org/x/sys/unix"
)
// https://www.gnu.org/software/libc/manual/html_node/Sockets.html#Sockets
@Hailong
Hailong / localStack.js
Created June 2, 2021 13:37
Start up LocalStack platform with Node.js code. It creates the same environment variables and mount points as the PIP `localstack start` is doing.
import { Docker } from 'node-docker-api'
import { dirSync } from 'tmp'
export async function bootLocalStack () {
const docker = new Docker({ socketPath: '/var/run/docker.sock' })
const tmpDir = dirSync()
await Promise.all((await docker.container.list({ all: 1 }))
.filter(container => container.data.Image === 'localstack/localstack')
.map(container => container.delete({ force: true })))
@Hailong
Hailong / Index.php
Last active November 25, 2020 01:23
Fix ShipStation plugin for Magento 2.3
<?php
namespace Auctane\Api\Controller\Auctane;
use Exception;
use Magento\Framework\App\CsrfAwareActionInterface;
use Magento\Framework\App\Request\InvalidRequestException;
use Magento\Framework\App\RequestInterface;
class Index extends \Magento\Framework\App\Action\Action implements CsrfAwareActionInterface
{
@Hailong
Hailong / README.md
Last active November 24, 2020 18:23 — forked from roachhd/README.md
Basics of BrainFuck

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

BrainFuck Programming Tutorial by: Katie

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

INTRODUCTION

// by Erik Wrenholt
import java.util.*;
class Mandelbrot
{
static int BAILOUT = 16;
static int MAX_ITERATIONS = 1000;
private static int iterate(float x, float y)
{
@Hailong
Hailong / randomness.php
Created November 27, 2019 14:03
Randomness distribution test of different random functions
#!/usr/bin/env php
<?php
/**
* Randomness distribution test of different random functions
*/
$counters = [
'array_rand' => [],
'random_int' => [],
@Hailong
Hailong / robots.txt
Created September 5, 2019 17:14 — forked from hn-support/robots.txt
Magento 2 recommended additions for robots.txt
User-agent: *
# Directories
Disallow: /app/
Disallow: /bin/
Disallow: /dev/
Disallow: /lib/
Disallow: /phpserver/
Disallow: /pkginfo/
Disallow: /report/
@Hailong
Hailong / my.cnf
Created June 29, 2019 01:47 — forked from kenelliott/my.cnf
16CPU / 16GB My.cnf
[mysqld_safe]
nice = -15
[mysqld]
max_binlog_size = 256M #max size for binlog before rolling
expire_logs_days = 1 #binlog files older than this will be purged
## Per-Thread Buffers * (max_connections) = total per-thread mem usage
thread_stack = 256K #default: 32bit: 192K, 64bit: 256K
sort_buffer_size = 1M #default: 2M, larger may cause perf issues