Skip to content

Instantly share code, notes, and snippets.

View lyzhang1999's full-sized avatar

wangwei lyzhang1999

  • Helium3 Tech
  • 广东深圳
View GitHub Profile
@mattetti
mattetti / gist:3798173
Last active August 21, 2024 05:26
async fetching of urls using goroutines and channels
package main
import (
"fmt"
"net/http"
"time"
)
var urls = []string{
"https://splice.com/",
@ngauthier
ngauthier / timeout_and_tick.go
Created February 10, 2015 18:14
Golang timeout and tick loop
// keepDoingSomething will keep trying to doSomething() until either
// we get a result from doSomething() or the timeout expires
func keepDoingSomething() (bool, error) {
timeout := time.After(5 * time.Second)
tick := time.Tick(500 * time.Millisecond)
// Keep trying until we're timed out or got a result or got an error
for {
select {
// Got a timeout! fail with a timeout error
case <-timeout:
@iffy
iffy / .gitignore
Last active August 15, 2024 09:27
Example using electron-updater with `generic` provider.
node_modules
dist/
yarn.lock
wwwroot
@innovia
innovia / kubernetes_add_service_account_kubeconfig.sh
Last active January 29, 2024 23:00
Create a service account and generate a kubeconfig file for it - this will also set the default namespace for the user
#!/bin/bash
set -e
set -o pipefail
# Add user to k8s using service account, no RBAC (must create RBAC after this script)
if [[ -z "$1" ]] || [[ -z "$2" ]]; then
echo "usage: $0 <service_account_name> <namespace>"
exit 1
fi
package main
import (
"bytes"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
"strconv"
import {
FirebaseAnalyticsJSCodedEvent,
FirebaseAnalyticsJSConfig,
FirebaseAnalyticsJSOptions,
} from './FirebaseAnalyticsJS.types';
/**
* A pure JavaScript Google Firebase Analytics implementation that uses
* the HTTPS Measurement API 2 to send events to Google Analytics.
*
@yangchuansheng
yangchuansheng / prometheus-rules-others.yaml
Created August 5, 2020 09:22
prometheus-rules-others.yaml
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
labels:
prometheus: others
role: alert-rules
name: prometheus-others-rules
namespace: monitoring
spec:
groups:
#!/usr/bin/env bash
# Inspired by: https://github.com/kayrus/kuttle
# Usage:
#
# sshuttle -v -r 'none' -e /path/to/this_script 172.20.0.0/16
#
set -e
VERSION=0.1
@duncangrist
duncangrist / helm-package.sh
Created April 7, 2021 10:42
Wraps "helm package" in order to be able to --set values at package time. Depends on yq and helm.
#!/usr/bin/env bash
scriptName=$(basename "$0")
USAGE="Wraps \"helm package\" in order to be able to --set values at package time.
Usage:
$scriptName \\
--set key1=value1 --set key2=value2 \\
[--app-version 1.2.3] <chart-path>"
@codemem
codemem / build-and-publish.yml
Created August 28, 2021 09:42
Build and Publish React Native Project to Testflight and Google Play
# Sources:
# https://blog.usejournal.com/automate-react-native-builds-with-github-actions-af54212d26dc
# https://zach.codes/ios-builds-using-github-actions-without-fastlane/
# https://stackoverflow.com/questions/16550594/jenkins-xcode-build-works-codesign-fails/19550453#19550453
# https://www.valueof.io/blog/deploying-to-google-play-using-github-actions
name: Build and Publish Test Builds
on:
push: