Skip to content

Instantly share code, notes, and snippets.

--with-file-aio \
--with-http_addition_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_random_index_module \
--with-http_secure_link_module \
@taosx
taosx / mysql_wait.sh
Created June 8, 2017 13:45
Wait for mysql connection
#https://stackoverflow.com/a/37300565
until nc -z -v -w30 $MYSQL_HOST 3306
do
echo "Waiting for database connection..."
# wait for 5 seconds before check again
sleep 5
done
@taosx
taosx / gist:07de1e5b1134e9d572294914b004f7a2
Created March 13, 2018 22:44
Keywords of techniques, algorithms that may be helpful.
Debouncing
type badStates =
| ECONNREFUSED /* database not running, or running on different port */
| SHUTTING_DOWN
| STARTING_UP
| ERROR(string);
let db_state = xs => (
Js.String.includes("ECONNREFUSED", xs),
Js.String.includes("is shutting down", xs),
@taosx
taosx / psql_migration.re
Created March 11, 2019 08:39
How you could improve this code?
let getMigrations: string => array(string) =
migrationsPath => Node.Fs.readdirSync(migrationsPath);
let readContent: string => string =
migrationFilePath => Node.Fs.readFileAsUtf8Sync(migrationFilePath);
let handleError = Js.String.make;
let countMigrations:
Postgres.client => Js.Promise.t(Belt.Result.t(int, Js.Promise.error)) =
function FindProxyForURL(url, host) {
host = host.toLowerCase();
if (shExpMatch(host, "*.nandomedia.com") || shExpMatch(host, "*.adobe.com")){
return "SOCKS 127.0.0.1:1337"; // (IP:port)
}
return "default";
}
import React, { Component, useState, useEffect, useRef } from "react"
import BackgroundImage from "gatsby-background-image"
import style from "./index.module.css"
// props: data.allFile.edges[].node.childImageSharp.fluid
class BackgroundSliderMain extends Component {
state = {
current: 0,
edgeIndex: 0,
from typing import Optional, List, Any
from marshmallow import Schema, fields, pprint
class Structure(object):
_fields = []
def _init_arg(self, expected_type, value):
if isinstance(value, expected_type):
return value
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="https://www.w3.org/2005/Atom" xmlns:dc="https://purl.org/dc/elements/1.1/"
xmlns:content="https://purl.org/rss/1.0/modules/content" xmlns:newsmail="//">
<channel>
<title>Daily Insider Newsletter</title>
<link>https://eprod.ncinsider.com/site-services/newsletters/daily-insider-newsletter/</link>
<atom:link href="https://eprod.ncinsider.com/feeds/fulltext/newsletter/daily-insider-newsletter" rel="self" type="application/rss+xml"></atom:link>
<description>Daily Insider Newsletter from the The Insider North Carolina State Government News Service newspaper in The Triangle.</description>
<language>en</language>

Interview Preparation

Created: Mar 19, 2020 4:37 PM Tags: Golang, Linux

When using an empty struct?

  • When you want to save some memory.
  • When implementing a data set.
  • When writing a seen hash