Skip to content

Instantly share code, notes, and snippets.

View Efrat19's full-sized avatar
🐤
Poking around

Efrat Levitan Efrat19

🐤
Poking around
View GitHub Profile
@phortuin
phortuin / signing-git-commits.md
Last active June 25, 2024 16:52
Set up a GPG key for signing Git commits on MacOS (M1)

Based on this blogpost.

To sign Git commits, you need a gpg key. GPG stands for GNU Privacy Guard and is the de facto implementation of the OpenPGP message format. PGP stands for ‘Pretty Good Privacy’ and is a standard to sign and encrypt messages.

Setting up

Install with Homebrew:

$ brew install gpg
@usametov
usametov / topics-search.txt
Created February 16, 2021 01:50
how to search github.com for multiple topics
Github.com ui .currently does not natively supoport search for multiple topic tags as of now. However their api allows you to query multiple tags. Below is a simple example to query github.com with ecs and go topic tags.
curl -H "Accept: application/vnd.github.mercy-preview+json" \
https://api.github.com/search/repositories?q=topic:ecs+topic:go
Response from the github can be rather verbose so lets filter only relavant info such repo url and description.
curl -H "Accept: application/vnd.github.mercy-preview+json" \
https://api.github.com/search/repositories\?q\=topic:ecs+topic:go | jq '.items[] | {url:.url, description:.description}'
@DaniJG
DaniJG / nginx-controller-dashboards.md
Last active April 11, 2022 14:14
Grafana dashboard for the kubernetes NGINX controller

NGINX-controller grafana dashboards

Adapted from the official dashboard located in the official nginx-controller repo: https://github.com/kubernetes/ingress-nginx/tree/master/deploy/grafana/dashboards.

Haven't dig up why yet, but in my setup with Grafana 6.3.6 (where at least for the performance dashboard 6.6.0 is recommended) and the nginx-controller 0.25.1, the range vector selectors in time series of [1m] and [2m] where causing no data being returned.

I also missed being able to see the data per host (as in the host name declared by each Ingress) or the namespace that defined the Ingress. So I added new parameters and filters for these.

@Efrat19
Efrat19 / clone-elastic-settings.sh
Last active October 22, 2019 11:56
clone all elastic indexes settings & mapping
#! /bin/bash
# in this script I assume you got elasticdump installed. https://github.com/taskrabbit/elasticsearch-dump
# if not, either run
# npm i -g elasticdump
# or use npx.
export SOURCE_HOST=http://localhost:9200
export DEST_HOST=http://localhost:9201
Questions are not from any actual exam!!!
Q: Create a job that calculates pi to 2000 decimal points using the container with the image named perl
and the following commands issued to the container: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"]
Once the job has completed, check the logs to and export the result to pi-result.txt.
Solution:
@nataliefl
nataliefl / daemonset-amd64.yaml
Last active October 25, 2021 03:16
kube-proxy setup for amd64 and arm architecture
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
labels:
k8s-app: kube-proxy
name: kube-proxy-amd64
namespace: kube-system
spec:
revisionHistoryLimit: 10
selector:
@lizturp
lizturp / cloudformation-kinesis-fh-delivery-stream.json
Last active November 3, 2022 03:34
AWS Cloudformation template to build a firehose delivery stream to S3, with a kinesis stream as the source. JSON, but it's fine.
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "The AWS CloudFormation template for Kinesis Stream",
"Parameters": {
"Environment": {
"Description": "dev, stage, or prod - this is for bucket tags",
"Type": "String",
"MinLength": "3",
"MaxLength": "5"
}
@scharton
scharton / proof_of_work.py
Last active November 30, 2023 15:41
Python proof of work example from Mastering Bitcoin
import hashlib
import time
max_nonce = 2 ** 32 # 4 billion
def proof_of_work(header, difficulty_bits):
# calculate the difficulty target
target = 2 ** (256-difficulty_bits)
@troyfontaine
troyfontaine / 1-setup.md
Last active June 25, 2024 11:37
Signing your Git Commits on MacOS

Methods of Signing Git Commits on MacOS

Last updated March 13, 2024

This Gist explains how to sign commits using gpg in a step-by-step fashion. Previously, krypt.co was heavily mentioned, but I've only recently learned they were acquired by Akamai and no longer update their previous free products. Those mentions have been removed.

Additionally, 1Password now supports signing Git commits with SSH keys and makes it pretty easy-plus you can easily configure Git Tower to use it for both signing and ssh.

For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing your commits with GPG.

@mhausenblas
mhausenblas / main.go
Created April 21, 2017 09:42
A simple Go program for interacting with a Kubernetes cluster
package main
import (
"flag"
"fmt"
"github.com/chzyer/readline"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/pkg/api/v1"
"k8s.io/client-go/tools/clientcmd"