Skip to content

Instantly share code, notes, and snippets.

View aslafy-z's full-sized avatar

Zadkiel AHARONIAN aslafy-z

View GitHub Profile
@zulhfreelancer
zulhfreelancer / zsh-timestamp.md
Last active February 12, 2024 14:52
How to add timestamp on right hand side of ZSH / iTerm2 terminal prompt?

Add the following snippet at the bottom of ~/.zshrc file.

Option 1 - Just time

RPROMPT='[%D{%L:%M:%S}] '$RPROMPT
@adah1972
adah1972 / hashable_cache.py
Last active July 31, 2023 17:00
Decorator for using dicts/lists with any Python cache function (like lru_cache)
# Inspired by https://gist.github.com/harel/9ced5ed51b97a084dec71b9595565a71
from collections import namedtuple
import functools
import json
import six
Serialized = namedtuple('Serialized', 'json')
@lewisrodgers
lewisrodgers / README.md
Last active April 9, 2024 09:50
Python boilerplate for service account oauth setup to return data from a Google API

Prerequisites

For a more detailed version of the steps below visit: https://developers.google.com/admin-sdk/directory/v1/guides/delegation

  • Enable the necessary APIs (calendar, drive, gmail, etc.) in Cloud Console
  • Create a service account, download the json key file, and enable domain wide delegation (DwD)
  • Determine the required scopes (calendar readonly, drive read/write, etc.)
  • In the G Suite console, an admin authorizes the service account (client ID) with the specified scopes
  • The admin also identifies an account — with proper admin privileges — that the service account will impersonate (when you want to access user's data without manual authorization from the user)
@fernandoacorreia
fernandoacorreia / with_backoff.sh
Last active November 26, 2019 13:27
Retries a command a with backoff
#!/bin/bash
set -o nounset -o errexit -o pipefail
# Retries a command a with backoff.
# Based on https://stackoverflow.com/a/8351489/376366
# and https://gist.github.com/fernandoacorreia/b4fa9ae88c67fa6759d271b743e96063
#
# The retry count is given by ATTEMPTS (default 7), the
# initial backoff timeout is given by TIMEOUT in seconds
# (default 1). With default settings, it will try for about 1 minute.
@geedew
geedew / symlink.sh
Last active November 21, 2022 10:00
A cross platform symlink method in Bash
@guettli
guettli / ssh-tunnel@.service
Created December 22, 2017 11:40
Reliable persistent SSH-Tunnel via systemd (not autossh)
# Reliable persistent SSH-Tunnel via systemd (not autossh)
# https://gist.github.com/guettli/31242c61f00e365bbf5ed08d09cdc006#file-ssh-tunnel-service
[Unit]
Description=Tunnel for %i
After=network.target
[Service]
User=tunnel
ExecStart=/usr/bin/ssh -o "ExitOnForwardFailure yes" -o "ServerAliveInterval 60" -N tunnel@%i
@vojtasvoboda
vojtasvoboda / .gitlab-ci.yml
Last active December 5, 2020 16:29
GitLab CI FTP deploy with mwienk/docker-lftp docker image
stages:
- test
- deploy
cache:
paths:
- vendor
# test job
test:
@acidzebra
acidzebra / cozmo_unleashed.py
Last active January 25, 2022 14:23
Cozmo Unleashed: Attempting to create a perpetuum cozmobile for Anki's awesome robot - https://www.anki.com/en-us/cozmo
#!/usr/bin/env python3
#
# NOTE I HAVE MOVED ON TO USING A CUSTOM MARKER PRINTED OUT AND PASTED ON TOP OF MY CHARGER
# SIZED AT 4CM/SIDE COZMO HAS A MUCH BETTER CHANCE OF FINDING THE CHARGER - SIMILAR TO THE NEW VECTOR ROBOT
# the last "general purpose" version is https://gist.github.com/acidzebra/c02ff8c8ccb0e3a057ae0b48a5082a68/ad4ff9d686f7e2a1b197c4a26c6290d51a7c4380
# if you want to print out your own you can find a version of marker CustomObjectMarkers.Hexagons2 used here
# http://cozmosdk.anki.com/docs/generated/cozmo.objects.html?highlight=hexagons2#cozmo.objects.CustomObjectMarkers.Hexagons2
#
# WHAT THIS PROGRAM DOES
#
@gboudreau
gboudreau / AuthyToOtherAuthenticator.md
Last active June 1, 2024 05:07 — forked from Ingramz/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy