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
@wosephjeber
wosephjeber / ngrok-installation.md
Last active June 4, 2024 07:48
Installing ngrok on Mac

Installing ngrok on OSX

For Homebrew v2.6.x and below:

brew cask install ngrok

For Homebrew v2.7.x and above:

@tiesmaster
tiesmaster / disable-branch-protection.sh
Last active September 5, 2023 08:06
Enable/disable branch protection on GitHub through their API
#!/bin/bash
OAUTH2_TOKEN=<fill in your own OAUTH2 token>
OWNER=tiesmaster
REPO=Coolkit.Converters # retrieve this with: basename $(git config --get remote.origin.url) .git
curl https://api.github.com/repos/${OWNER}/${REPO}/branches/master \
-H "Authorization: token $OAUTH2_TOKEN" \
-H "Accept: application/vnd.github.loki-preview+json" \
@shashankmehta
shashankmehta / setup.md
Last active January 7, 2024 11:57
Setup PHP and Composer on OSX via Brew

First install Brew on your MAC

  • Setup Brew: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • brew update
  • brew tap homebrew/dupes
  • brew tap homebrew/php
  • Install PHP 7.0.+ brew install php70
  • Install mcrypt: brew install mcrypt php70-mcrypt
  • Finally, install composer: brew install composer
@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"
@troyfontaine
troyfontaine / 1-setup.md
Last active June 29, 2024 13:29
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.

@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)
@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"
}
@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:
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:
@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