Skip to content

Instantly share code, notes, and snippets.

View abruzzihraig's full-sized avatar
🤢

Yang He abruzzihraig

🤢
  • Melbourne
  • 20:07 (UTC -12:00)
View GitHub Profile
@InsaneWookie
InsaneWookie / config_m1s_home_assistant.md
Last active April 26, 2024 07:05
Configure Aqara M1S Gateway for Home Assistant
@guoyoujin
guoyoujin / docker-etcd-compose.yml
Created January 8, 2018 08:25
docker-etcd-compose.yml
version: '2'
services:
etcd1:
image: quay.io/coreos/etcd:v3.2.5
restart: always
ports:
- 23791:2379
- 23801:2380
volumes:
@xameeramir
xameeramir / default nginx configuration file
Last active April 15, 2024 09:51
The default nginx configuration file inside /etc/nginx/sites-available/default
# Author: Zameer Ansari
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
@sanjeevshrestha
sanjeevshrestha / telegraf-dockercompose.yml
Last active July 24, 2022 01:12
Telegraf Docker Compose file
telegraf:
image: telegraf
restart: always
environment:
HOST_PROC: /rootfs/proc
HOST_SYS: /rootfs/sys
HOST_ETC: /rootfs/etc
hostname: localhost
volumes:
- ./telegraf/telegraf.conf:/etc/telegraf/telegraf.conf:ro
@joshisa
joshisa / URL Parsing
Created February 3, 2017 02:27
Parsing of URLs using bash sh scripting
#!/bin/bash
# Referenced and tweaked from http://stackoverflow.com/questions/6174220/parse-url-in-shell-script#6174447
proto="$(echo $1 | grep :// | sed -e's,^\(.*://\).*,\1,g')"
# remove the protocol
url="$(echo ${1/$proto/})"
# extract the user (if any)
userpass="$(echo $url | grep @ | cut -d@ -f1)"
pass="$(echo $userpass | grep : | cut -d: -f2)"
if [ -n "$pass" ]; then
@vlucas
vlucas / encryption.js
Last active April 2, 2024 14:26
Stronger Encryption and Decryption in Node.js
'use strict';
const crypto = require('crypto');
const ENCRYPTION_KEY = process.env.ENCRYPTION_KEY; // Must be 256 bits (32 characters)
const IV_LENGTH = 16; // For AES, this is always 16
function encrypt(text) {
let iv = crypto.randomBytes(IV_LENGTH);
let cipher = crypto.createCipheriv('aes-256-cbc', Buffer.from(ENCRYPTION_KEY), iv);
@idiotWu
idiotWu / themr.js
Last active March 29, 2017 03:22
Another theme-able solution for react reusable components.
/*
* Usage:
*
* As a decorator:
*
* import defaultTheme from './style.scss';
*
* @themr(defaultTheme)
* class Comp extends React.Component { ... }
*
@abruzzihraig
abruzzihraig / angular-amap.js
Last active July 5, 2016 05:45
AMap/高德地图 module wrapper with angular
/*
* The module amap below is a simplest implementation, there is no any updated or proper libraries when I wrote it.
* Since there is a new full-feature library which wrote by another guy, so I just recommend it below.
* https://github.com/leftstick/angular-amap
*
* If you just want version with a few features like below, you could just build your version on top of it.
*/
angular.module('amap', [])
.constant('amapConstant', {
@idiotWu
idiotWu / attach-events.js
Last active October 6, 2017 15:22
attach-events decorator for react
/**
* @decorator
* Attach events to DOM element
*
* @param {Element|Function} elemOrFunc: DOM Element, or a function returns element
* @param {String} events: a list events separated with ','
*
* Usage:
* @attachEvents(window, 'click')
* handleWindowClick(evt) {
@bjhomer
bjhomer / instructions.md
Last active January 17, 2023 23:03
How to make the Day One command line tool automatically write to Day One 2

Using the Day One CLI with Day One 2

The dayone command line tool was originally written to work with Day One Classic, and by default writes its entries to the default Day One Classic journal directory1. If you want to use the dayone tool to write entries in to Day One 2 instead, there are a couple options.




Option 1. Use this option if you don't use Day One Classic at all.