Skip to content

Instantly share code, notes, and snippets.

View nicklaw5's full-sized avatar
🏠
Working from home

Nick Law nicklaw5

🏠
Working from home
View GitHub Profile
@nicklaw5
nicklaw5 / _usage.md
Last active December 10, 2019 23:49
Read AWS Kinesis Stream in Go (Golang)

Usage

# Build it
go build -o go-kinesis main.go

# Run it
./go-kinesis <aws_region> <stream_name> [<log_group>]
@nicklaw5
nicklaw5 / ramdom_sha1.go
Last active December 19, 2022 10:25
Golang - Generate random SHA1 hash
// Source: https://stackoverflow.com/questions/12321133/golang-random-number-generator-how-to-seed-properly
package main
import (
"crypto/sha1"
"fmt"
"math/rand"
"time"
)
@nicklaw5
nicklaw5 / filebeat.yml
Last active June 25, 2019 14:10
Logstash & Filebeat configuration for parsing MariaDB Slow Logs
#=========================== Filebeat prospectors =============================
filebeat.prospectors:
- input_type: log
document_type: mariadb-slowlogs
paths:
- "/var/log/mysql/mariadb-slow.log"
multiline:
pattern: '^# User@Host: '
negate: true
match: after
@nicklaw5
nicklaw5 / RequestQuoteForm.js
Created July 19, 2017 19:26
RequestQuoteForm.js
import React, { Component } from 'react'
import FormData from './RequestQuoteData'
import ButtonGroup from './groups/ButtonGroup'
import InputFormGroup from './groups/InputFormGroup'
import SelectFormGroup from './groups/SelectFormGroup'
import DatepickerFormGroup from './groups/DatepickerFormGroup'
class RequestQuoteForm extends Component {
constructor(props) {
super(props)
@nicklaw5
nicklaw5 / SelectFormGroup.js
Created July 19, 2017 19:25
SelectFormGroup.js
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import Select from '../elements/Select'
class SelectFormGroup extends Component {
constructor(props) {
super(props)
this.state = {
name: this.props.name,
label: this.props.label,
@nicklaw5
nicklaw5 / Select.js
Created July 19, 2017 19:24
Select.js
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import ReactSelect from 'react-select'
class Select extends Component {
constructor(props) {
super(props)
this.state = {
name: this.props.name,
value: this.props.value,
@nicklaw5
nicklaw5 / vm-resize-hard-disk.md
Created March 16, 2017 07:00 — forked from christopher-hopper/vm-resize-hard-disk.md
Resize a Hard Disk for a Virtual Machine provisioned using Vagrant from a Linux base box to run using VirutalBox.

Resize a Hard Disk for a Virtual Machine

Our Virtual Machines are provisioned using Vagrant from a Linux base box to run using VirutalBox. If the Hard Disk space runs out and you cannot remove files to free-up space, you can resize the Hard Disk using some VirtualBox and Linux commands.

Some assumptions

The following steps assume you've got a set-up like mine, where:

@nicklaw5
nicklaw5 / slim-example.md
Created February 24, 2017 23:58
slim example

directory structure:

/my-project
  /public
     index.php
  /src
     /Controllers
        UsersController.php
  /test
@nicklaw5
nicklaw5 / await-async.js
Created January 20, 2017 19:48 — forked from MichalZalecki/await-async.js
Run generators and and await/async
import axios from "axios";
export default async function () {
const { data: { id } } = await axios.get("//localhost:3000/id");
const { data: { group } } = await axios.get("//localhost:3000/group");
const { data: { name } } = await axios.get(`//localhost:3000/${group}/${id}`);
console.log(name); // Michał
}
@nicklaw5
nicklaw5 / .env.travis
Created January 4, 2017 22:03 — forked from gilbitron/.env.travis
Laravel 5 Travis CI config
APP_ENV=testing
APP_KEY=SomeRandomString
DB_CONNECTION=testing
DB_TEST_USERNAME=root
DB_TEST_PASSWORD=
CACHE_DRIVER=array
SESSION_DRIVER=array
QUEUE_DRIVER=sync