Skip to content

Instantly share code, notes, and snippets.

@metrue
metrue / nginx.conf
Created November 4, 2020 15:12 — forked from shortjared/nginx.conf
AWS API Gateway Nginx Reverse Proxy
# NOTE
#
#
# Use sed on the instance up to replace the INSTANCE_ID and DNS_RESOLVER with the following commands
#
####################################################################################################
# Fetch the private IP for resolving DNS dynamically in nginx
# We also need to escape the `.` from it for usage in later sed
#
# DNS_RESOLVER=`grep nameserver /etc/resolv.conf | cut -d " " -f2 | sed 's/\./\\./g'`
JavaScript 14 hrs 12 mins ███████████████▊░░░░░ 75.2%
JSON 1 hr 36 mins █▊░░░░░░░░░░░░░░░░░░░ 8.6%
JSX 57 mins █░░░░░░░░░░░░░░░░░░░░ 5.0%
Other 43 mins ▊░░░░░░░░░░░░░░░░░░░░ 3.9%
YAML 37 mins ▋░░░░░░░░░░░░░░░░░░░░ 3.3%
@metrue
metrue / pod.go
Last active October 16, 2019 10:28
exec command in K8S Pod
func ExecPod(namespace string, name string, command ...string) error {
config, err := clientcmd.BuildConfigFromKubeconfigGetter("", clientcmd.NewDefaultClientConfigLoadingRules().Load)
if err != nil {
return nil, err
}
k, err := kubernetes.NewForConfig(config)
if err != nil {
return nil, err
}
@metrue
metrue / submit.md
Created September 19, 2019 05:19 — forked from tanaikech/submit.md
Uploading Files to OneDrive Using Node.js

In order to use this script, please retrieve client id, client secret and refresh token before. About this, you can see the detail information at https://gist.github.com/tanaikech/d9674f0ead7e3320c5e3184f5d1b05cc.

1. Simple item upload

This is for the simple item upload is available for items with less than 4 MB of content. The detail information is https://dev.onedrive.com/items/upload_put.htm.

var fs = require('fs');
var mime = require('mime');
var request = require('request');
@metrue
metrue / fetch-api-examples.md
Created September 3, 2019 21:05 — forked from justsml/fetch-api-examples.md
JavaScript Fetch API Examples
@metrue
metrue / generated code
Created August 29, 2019 06:59
protobuf bug reproduce
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: backup_svc/backup_svc.proto
/*
Package backup_svc is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
*/
package backup_svc
@metrue
metrue / docker-cleanup-resources.md
Created August 10, 2018 10:09 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@metrue
metrue / limitConcurrentGoroutines.go
Created August 5, 2018 09:33 — forked from AntoineAugusti/limitConcurrentGoroutines.go
Limit the maximum number of goroutines running at the same time
package main
import (
"flag"
"fmt"
"time"
)
// Fake a long and difficult work.
func DoWork() {
@metrue
metrue / web-servers.md
Created November 19, 2017 15:07 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@metrue
metrue / media-queries.scss
Created July 30, 2017 13:00 — forked from chrisjlee/media-queries.scss
All Media Queries breakpoints
@media (min-width:320px) { /* smartphones, portrait iPhone, portrait 480x320 phones (Android) */ }
@media (min-width:480px) { /* smartphones, Android phones, landscape iPhone */ }
@media (min-width:600px) { /* portrait tablets, portrait iPad, e-readers (Nook/Kindle), landscape 800x480 phones (Android) */ }
@media (min-width:801px) { /* tablet, landscape iPad, lo-res laptops ands desktops */ }
@media (min-width:1025px) { /* big landscape tablets, laptops, and desktops */ }
@media (min-width:1281px) { /* hi-res laptops and desktops */ }