This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def my_generator(): | |
yield 1 | |
yield 2 | |
yield 3 | |
return 4 | |
gen = my_generator() | |
next(gen) # 1 | |
next(gen) # 2 | |
next(gen) # 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <functional> | |
#include <vector> | |
#include <algorithm> | |
class defer_frame { | |
public: | |
using function = std::function<void(void)>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: setup@kindconfig | |
run: | | |
kind_in="${{ github.workspace }}/.github/config/kind.yml.in" | |
kind_out="${{ github.workspace }}/.github/config/kind.yml" | |
hostip=$(sh .github/scripts/get-docker-host.sh) | |
sed "s/127.0.0.1/$hostip/g" $kind_in > $kind_out | |
- name: setup@kubernetes | |
uses: engineerd/setup-kind@v0.5.0 | |
with: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
kind: Cluster | |
apiVersion: kind.x-k8s.io/v1alpha4 | |
networking: | |
apiServerAddress: "127.0.0.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# uses script from https://gist.github.com/linkdd/4bbd9fc4966e00e067305f1fb8c2588c | |
- name: setup@kubeconfig | |
run: | | |
hostip=$(sh .github/scripts/get-docker-host.sh) | |
sed "s/127.0.0.1/$hostip/g" $HOME/.kube/config > ${{ github.workspace }}/kubeconfig.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
cat <<EOF | docker run --rm -i alpine:latest sh | |
apk add --no-cache iproute2 >/dev/null | |
ip -4 route show default | cut -d' ' -f3 | |
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Layers containing files for the next stages | |
# Project configuration | |
FROM scratch AS context | |
ADD mix.exs mix.lock /workspace/ | |
ADD config /workspace/config | |
# Asset files | |
FROM scratch AS assets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Can be used with https://github.com/xcv58/Custom-JavaScript-for-Websites-2 | |
// This snippet is released under the terms of the CC0 license: https://creativecommons.org/publicdomain/zero/1.0/deed.en | |
const cache_key = 'hn_comments_views' | |
const cache = JSON.parse(localStorage.getItem(cache_key) || '{}') | |
document.querySelectorAll('.athing.comtr').forEach(comm => { | |
if (!cache[comm.id]) { | |
const span = document.createElement('span') | |
span.innerHTML = '🔔' // :bell: emoji |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Config | |
config :datapio_cluster, | |
service_name: [env: "MYAPP_SERVICE_NAME", default: nil], | |
app_name: [env: "MYAPP_APP_NAME", default: "my_app"], | |
cache_tables: [ | |
some_set: [:id, :attr1, :attr2], | |
some_other_set: [:id, :attr] | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule MyApp.MixProject do | |
use Mix.Project | |
def project do | |
[ | |
app: :my_app, | |
version: "0.1.0", | |
elixir: "~> 1.12", | |
start_permanent: Mix.env() == :prod, | |
deps: deps() |