Skip to content

Instantly share code, notes, and snippets.

View mgnisia's full-sized avatar

Moritz Gnisia mgnisia

View GitHub Profile
["4.148.0.0/16", "4.149.0.0/18", "4.149.64.0/19", "4.149.96.0/19", "4.149.128.0/17", "4.150.0.0/18", "4.150.64.0/18", "4.150.128.0/18", "4.150.192.0/19", "4.150.224.0/19", "4.151.0.0/16", "4.152.0.0/15", "4.154.0.0/15", "4.156.0.0/15", "4.175.0.0/16", "4.180.0.0/16", "4.207.0.0/16", "4.208.0.0/15", "4.210.0.0/17", "4.210.128.0/17", "4.227.0.0/17", "4.227.128.0/17", "4.231.0.0/17", "4.231.128.0/17", "4.236.0.0/17", "4.236.128.0/17", "4.242.0.0/17", "4.242.128.0/17", "4.245.0.0/17", "4.245.128.0/17", "4.246.0.0/17", "4.246.128.0/17", "4.249.0.0/17", "4.249.128.0/17", "4.255.0.0/17", "9.163.0.0/16", "9.169.0.0/17", "9.169.128.0/17", "9.234.0.0/17", "9.234.128.0/17", "13.64.0.0/16", "13.65.0.0/16", "13.66.0.0/17", "13.66.128.0/17", "13.67.128.0/20", "13.67.144.0/21", "13.67.152.0/24", "13.67.153.0/28", "13.67.153.32/27", "13.67.153.64/26", "13.67.153.128/25", "13.67.155.0/24", "13.67.156.0/22", "13.67.160.0/19", "13.67.192.0/18", "13.68.0.0/17", "13.68.128.0/17", "13.69.0.0/17", "13.69.128.0/17", "13.70.192.0/18"
# [googleadservices.com]
0.0.0.0 googleadservices.com
0.0.0.0 pagead2.googleadservices.com
0.0.0.0 www.googleadservices.com
@mgnisia
mgnisia / tf_vars_sort.awk
Created February 10, 2023 10:47 — forked from yermulnik/tf_vars_sort.awk
Sort Terraform (HCL) file by Resource Block Names using `awk`
#!/usr/bin/env -S gawk -f
# for MACOS: brew install gawk
# https://gist.github.com/yermulnik/7e0cf991962680d406692e1db1b551e6
# Tested with GNU Awk 5.0.1, API: 2.0 (GNU MPFR 4.0.2, GNU MP 6.2.0)
# Usage: cat variables.tf | awk -f /path/to/tf_vars_sort.awk | tee sorted_variables.tf
# No licensing; [email protected], 2021-2022
{
# skip blank lines at the beginning of file
if (!resource_type && length($0) == 0) next
// Resource: https://zetcode.com/golang/find-file/
package main
import (
"fmt"
"log"
"os"
"path/filepath"
"regexp"
)
@mgnisia
mgnisia / client_go_example.go
Created August 8, 2022 12:51
Client Go with Home Directory Example
package main
import (
"context"
"flag"
"log"
"path/filepath"
"testing"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@mgnisia
mgnisia / docker-compose.yml
Created May 10, 2022 09:21
Local Kafka Setup
version: '3.4'
services:
zookeeper:
image: confluentinc/cp-zookeeper:latest
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
ZOOKEEPER_INIT_LIMIT: 5
ZOOKEEPER_SYNC_LIMIT: 2
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx-jsmdg
spec:
replicas: 3
selector:
matchLabels:
@mgnisia
mgnisia / main.go
Created March 15, 2022 13:17
Reset Kakfa Consumer Group to specific offset
package main
import (
"context"
kafka "github.com/segmentio/kafka-go"
log "github.com/sirupsen/logrus"
"time"
)
type Config struct {
@mgnisia
mgnisia / print_tensor.py
Created October 6, 2020 08:42
Printing of three dimensional tensor
# Assumption tensor == np.array
def print_tensor(tensor):
for i3 in range(0, tensor.shape[0]):
for i1 in range(0, tensor.shape[2]):
string_line = ""
for i2 in range(0, tensor.shape[1]):
string_line += " {:3.2f} ".format(tensor[i3][i2][i1])
print(string_line)
print("------------------------------------")
@mgnisia
mgnisia / ravel_index.h
Created September 23, 2020 17:56
Transform 1D Index Notation to 3D Index notation in C++ / CPP
template<typename T>
std::array<T,3> index_3D(T index, T size) {
T x = index % size;
T tmp = (index - x) / size;
T y = tmp % size;
T z = (tmp - y) / size;
return std::array<T,3>{z,y,x};
}