Skip to content

Instantly share code, notes, and snippets.

View fabito's full-sized avatar
🐮
Working from home

Fábio Franco Uechi fabito

🐮
Working from home
View GitHub Profile
@karpathy
karpathy / stablediffusionwalk.py
Last active July 25, 2024 22:17
hacky stablediffusion code for generating videos
"""
stable diffusion dreaming
creates hypnotic moving videos by smoothly walking randomly through the sample space
example way to run this script:
$ python stablediffusionwalk.py --prompt "blueberry spaghetti" --name blueberry
to stitch together the images, e.g.:
$ ffmpeg -r 10 -f image2 -s 512x512 -i blueberry/frame%06d.jpg -vcodec libx264 -crf 10 -pix_fmt yuv420p blueberry.mp4
@calvinf
calvinf / github-docker-build-and-push.yml
Created January 8, 2022 17:57
Github Action for Docker Build and Push to Google Artifact Registry
name: CI
on:
push:
branches:
- main
pull_request:
env:
# Github Container registry
@ryu1kn
ryu1kn / README.md
Last active June 25, 2024 10:50
Getting GCP access token from a service account key JSON file

Getting GCP access token from a service account key

Use your service account's key JSON file to get an access token to call Google APIs.

Good for seeing how things work, including the creation of JWT token.

To create a JWT token, you can replace create-jwt-token.sh script with tools like step.

If you just want to get an access token for a service account,

Git orphan branches & working trees

Creating an ophan branch

This command will create a branch with no parent (no commit history) on a repo.

git checkout --orphan <new-branch>

Managing working trees

Manage folders linked to others branches of your repo. Do not confuse them with git submodules which are links to different repositories.

import faiss
# example data
xb = np.random.rand(200000, 32).astype('float32')
xq = np.random.rand(500, 32).astype('float32')
# get reference result with index
index = faiss.IndexFlatL2(xb.shape[1])
index.add(xb)
lims, D, I = index.range_search(xq, 1.5)
@bykvaadm
bykvaadm / sentry.py
Created June 4, 2018 08:58 — forked from fliphess/sentry.py
Ansible sentry callback plugin - Send all errors from ansible to Sentry
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import getpass
import logging
import logging.config
import os
import socket
try:
@codan-telcikt
codan-telcikt / geometry_geojson.yaml
Last active September 3, 2023 11:47 — forked from bubbobne/geometry_geojson.yaml
An OpenAPI definition for GeoJSON with Geometry and Features.
# MIT License
#
# Copyright (c) 2017 Daniele Andreis <daniele.andreis@gmail.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
# 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, subject to the following conditions:
@codersquid
codersquid / another_example.py
Last active June 25, 2024 00:56
a learning example for using a pushgateway with prometheus
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Canonical Ltd.
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
@craigafinch
craigafinch / gcs.service
Last active August 7, 2019 06:37
A systemd service to manage a Google Cloud Storage bucket mounted with GCSFuse
# https://github.com/GoogleCloudPlatform/gcsfuse
[Unit]
Description=Google Cloud Storage FUSE mounter
After=local-fs.target network-online.target google.service sys-fs-fuse-connections.mount
Before=shutdown.target
[Service]
Type=forking
User=apache
@soply
soply / disp_multiple_images.py
Last active January 9, 2024 14:52
Plot multiple images with matplotlib in a single figure. Titles can be given optionally as second argument.
import matplotlib.pyplot as plt
import numpy as np
def show_images(images, cols = 1, titles = None):
"""Display a list of images in a single figure with matplotlib.
Parameters
---------
images: List of np.arrays compatible with plt.imshow.