Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
cloudflare_email='your sign-in email'
cloudflare_apikey='your api key'
cloudflare_dns_record='your dns record'
cloudflare_zone_id='your dns zone id on cloudflare'
cloudflare_dns_record_id='your dns record id under the zone'
data_string=$( jq -n \
--arg ip "$(curl --silent ipecho.net/plain)" \
@davxiao
davxiao / VideoSummary.ipynb
Created December 4, 2023 22:31
modified VideoSummary.ipynb from llama-recipes/demo_apps
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@davxiao
davxiao / ca.conf
Created October 11, 2020 02:57
Default configuration for signing client certificate using self-signed CA
[ ca ]
default_ca = ca_default
[ ca_default ]
dir = ./ca
certs = $dir
new_certs_dir = $dir/ca.db.certs
database = $dir/ca.db.index
serial = $dir/ca.db.serial
RANDFILE = $dir/ca.db.rand
#!/usr/bin/env bash
#
# https://gist.github.com/davxiao/66a0c9f8f5bbe4ad543056e2b056ecd2
#
function usage
{
echo "This script generates AWS CLI commands for enumerating VPCs in specified accounts and regions."
echo "Edit script to add profile names and regions."
}
@davxiao
davxiao / aws-network-acl.sh
Last active August 19, 2020 01:12
construct AWS CLI commands to delete and add back NACL egress rules in VPC
#!/bin/sh
MY_VPC_ID=vpc-012f140a162878def;
PROFILE_NAME=lab-acc1;
REGION_NAME=us-east-1;
date
echo "This script needs AWS CLI to run properly. It looks up in the AWS environment and construct commands for you."
echo "It requires read only privileges, it does NOT change anything on your AWS environment."
echo "MY_VPC_ID=$MY_VPC_ID"
@davxiao
davxiao / comments.html
Created June 10, 2020 20:43
My modified version of layouts/partials/comments.html that integrates remark42
{{ if (index site.Params.comments.commentable .Type) | and (ne .Params.commentable false) | or .Params.commentable }}
<section id="comments">
<hr>
<h2>Comments</h2><div id="remark42"></div>
<script>
var remark_config = {
host: "https://api.davidxiao.me/remark42", // hostname of remark server, same as REMARK_URL in backend config, e.g. "https://demo.remark42.com"
site_id: 'davidxiao',
components: ['embed'], // optional param; which components to load. default to ["embed"]
// to load all components define components as ['embed', 'last-comments', 'counter']
# SSL configuration
#
server {
listen 8964 ssl;
# allowing only local networks and cloudflare CDN IPs for security
allow 127.0.0.0/8;
allow 192.168.2.0/24;
# cloudflare IPs. see https://www.cloudflare.com/ips/
@davxiao
davxiao / main.cf
Created June 8, 2020 17:45
Postfix config for Gmail relay. Only allowing relay request from local network.
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
myhostname=pve.home
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
@davxiao
davxiao / index.js
Created May 28, 2020 14:00
Google Cloud Function built for Dialogflow fulfillment
// See https://github.com/dialogflow/dialogflow-fulfillment-nodejs
// for Dialogflow fulfillment library docs, samples, and to report issues
'use strict';
const {
Image,
MediaObject,
Suggestions,
} = require('actions-on-google');
const functions = require('firebase-functions');