Skip to content

Instantly share code, notes, and snippets.

View Jerry0420's full-sized avatar
🏠
Looking for a remote job.

Yen Lung Wang Jerry0420

🏠
Looking for a remote job.
View GitHub Profile
@maestre3d
maestre3d / sse.go
Created July 25, 2020 17:15
Server Sent Events (SSE) broker written in Go
package sse
import (
"encoding/json"
"fmt"
"github.com/alexandria-oss/core"
"github.com/go-kit/kit/log"
"net/http"
"sync"
)
@stasius12
stasius12 / countries.py
Created September 23, 2018 10:38
List of all timezones with name of country and country code
countries = [
{'timezones': ['Asia/Kabul'], 'code': 'AF', 'name': 'Afghanistan'},
{'timezones': ['Europe/Mariehamn'], 'code': 'AX', 'name': 'Aland Islands'},
{'timezones': ['Europe/Tirane'], 'code': 'AL', 'name': 'Albania'},
{'timezones': ['Africa/Algiers'], 'code': 'DZ', 'name': 'Algeria'},
{'timezones': ['Pacific/Pago_Pago'], 'code': 'AS', 'name': 'American Samoa'},
{'timezones': ['Europe/Andorra'], 'code': 'AD', 'name': 'Andorra'},
{'timezones': ['Africa/Luanda'], 'code': 'AO', 'name': 'Angola'},
{'timezones': ['America/Anguilla'], 'code': 'AI', 'name': 'Anguilla'},
{'timezones': ['Antarctica/Casey', 'Antarctica/Davis', 'Antarctica/DumontDUrville', 'Antarctica/Mawson', 'Antarctica/McMurdo', 'Antarctica/Palmer', 'Antarctica/Rothera', 'Antarctica/Syowa', 'Antarctica/Troll', 'Antarctica/Vostok'], 'code': 'AQ', 'name': 'Antarctica'},
@jun06t
jun06t / vault-golang-login
Created July 13, 2018 15:56
Golang Vault Login Sample
package main
import (
"encoding/json"
"fmt"
"net/http"
"time"
"github.com/hashicorp/vault/api"
"github.com/hashicorp/vault/builtin/credential/aws"
@ummjackson
ummjackson / killabot.py
Created May 4, 2018 08:05
killabot v1 (wip)
# Requirements: pip install tweepy fuzzywuzzy python-Levenshtein
import tweepy
import re
from fuzzywuzzy import fuzz
# Credentials go here (generate at: https://apps.twitter.com)
auth = tweepy.OAuthHandler('consumer_key', 'consumer_secret')
auth.set_access_token('access_token', 'access_token_secret')
# Connect to Twitter
@tallclair
tallclair / git-repo-demo.yaml
Created March 9, 2018 19:54
More secure GitRepo volumes
# Example of using an InitContainer in place of a GitRepo volume.
# Unilke GitRepo volumes, this approach runs the git command in a container,
# with the associated hardening.
apiVersion: v1
kind: Pod
metadata:
name: git-repo-demo
annotations:
seccomp.security.alpha.kubernetes.io/pod: 'docker/default'
spec:
@a7madgamal
a7madgamal / dark.md
Last active July 14, 2023 04:00
Dark mode for Slack on MacOS
pragma solidity ^0.4.10;
/**
* Base contract that all upgradeable contracts should use.
*
* Contracts implementing this interface are all called using delegatecall from
* a dispatcher. As a result, the _sizes and _dest variables are shared with the
* dispatcher contract, which allows the called contract to update these at will.
*
* _sizes is a map of function signatures to return value sizes. Due to EVM
@lattner
lattner / TaskConcurrencyManifesto.md
Last active June 29, 2024 14:26
Swift Concurrency Manifesto
@lattner
lattner / async_swift_proposal.md
Last active April 21, 2024 09:43 — forked from oleganza/async_swift_proposal.md
Concrete proposal for async semantics in Swift

Async/Await for Swift

Introduction

Modern Cocoa development involves a lot of asynchronous programming using closures and completion handlers, but these APIs are hard to use. This gets particularly problematic when many asynchronous operations are used, error handling is required, or control flow between asynchronous calls gets complicated. This proposal describes a language extension to make this a lot more natural and less error prone.

This paper introduces a first class Coroutine model to Swift. Functions can opt into to being async, allowing the programmer to compose complex logic involving asynchronous operations, leaving the compiler in charge of producing the necessary closures and state machines to implement that logic.

@reagent
reagent / 00_README.md
Last active January 29, 2024 13:31
Custom HTTP Routing in Go

Custom HTTP Routing in Go

Basic Routing

Responding to requests via simple route matching is built in to Go's net/http standard library package. Just register the path prefixes and callbacks you want invoked and then call the ListenAndServe to have the default request handler invoked on each request. For example:

package main

import (