Skip to content

Instantly share code, notes, and snippets.

View alexanderscott's full-sized avatar

Alex Ehrnschwender alexanderscott

View GitHub Profile
@benkehoe
benkehoe / aws-profile-for-bashrc.sh
Last active April 2, 2024 10:41
AWS_PROFILE env var management
# MIT No Attribution
#
# Copyright 2022 Ben Kehoe
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this
# software and associated documentation files (the "Software"), to deal in the Software
# without restriction, including without limitation the rights to use, copy, modify,
# merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so.
#
/*
Adapted from https://github.com/sindresorhus/github-markdown-css
The MIT License (MIT)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
@pualien
pualien / get_track_uri_from_playlist.py
Last active August 9, 2020 19:23
List of spotify uri from given playlist URI
import os
import requests
PLAYLIST_URI = os.environ['PLAYLIST_URI']
SPOTIFY_TOKEN = os.environ['SPOTIFY_TOKEN'] # from default api login or more easily from chrome network inspecting calls directed to api.spotify.com
url = "https://api.spotify.com/v1/playlists/{}".format(PLAYLIST_URI)
querystring = {"type": "track,episode", "market": "from_token"}
headers = {
@mhkeller
mhkeller / concat.bash
Created October 22, 2018 15:09
Concatenate csv files
# Adapted from https://unix.stackexchange.com/questions/60577/concatenate-multiple-files-with-same-header#170692
# `head -1` gets first line of the file of the file and stashes them as the header row into `all.txt`
# `tail -n +2 -q *.csv >> all.txt` grabs every csv file from the second row down and stashes them into `all.txt`
# `all.txt` is a csv file but we use the txt extension to avoid it being captured in the `*.csv` glob.
# You could also output to a csv file by having your input files share a naming convention such as `file-001.csv` and glob on `file*.csv`
# But renaming `all.txt` to `all.csv` is sometimes easier than worrying about a naming convention and txt and csvs are the same thing
head -1 my-csv-01.csv > all.txt; tail -n +2 -q *.csv >> all.txt
@mduhan
mduhan / SetKafkaConsumergroupOffset.java
Created August 18, 2018 14:09
Java code to update Consumer group offset
package com.operative.pipelinetracker.controller;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import org.apache.kafka.clients.consumer.KafkaConsumer;
import org.apache.kafka.clients.consumer.OffsetAndMetadata;
import org.apache.kafka.common.TopicPartition;
import org.apache.kafka.common.serialization.StringDeserializer;
# .net core, kubernetes tool stack on MacOS
https://www.jetbrains.com/rider/
http://www.mono-project.com/download/stable/
https://www.microsoft.com/net/download/thank-you/dotnet-sdk-2.1.300-macos-x64-installer
https://www.microsoft.com/net/download/macos
https://github.com/kubernetes/minikube/releases
https://kubernetes.io/docs/tasks/tools/install-kubectl/
# dotnet core docker
https://hub.docker.com/r/microsoft/dotnet/

How we incorporate next and cloudfront (2018-04-21)

Feel free to contact me at robert.balicki@gmail.com or tweet at me @statisticsftw

This is a rough outline of how we utilize next.js and S3/Cloudfront. Hope it helps!

It assumes some knowledge of AWS.

Goals

@enricofoltran
enricofoltran / main.go
Last active June 26, 2024 12:16
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@marwei
marwei / how_to_reset_kafka_consumer_group_offset.md
Created November 9, 2017 23:39
How to Reset Kafka Consumer Group Offset

Kafka 0.11.0.0 (Confluent 3.3.0) added support to manipulate offsets for a consumer group via cli kafka-consumer-groups command.

  1. List the topics to which the group is subscribed
kafka-consumer-groups --bootstrap-server <kafkahost:port> --group <group_id> --describe

Note the values under "CURRENT-OFFSET" and "LOG-END-OFFSET". "CURRENT-OFFSET" is the offset where this consumer group is currently at in each of the partitions.

  1. Reset the consumer offset for a topic (preview)
@toja
toja / .block
Last active March 8, 2023 00:26
Perlin noise - 3D Demo
license: gpl-3.0
height: 480
border: no