Skip to content

Instantly share code, notes, and snippets.

View dmigo's full-sized avatar

Dmitry Goryunov dmigo

View GitHub Profile
@dmigo
dmigo / ray-inference.py
Last active June 17, 2022 15:24
Runs haystack indexing on ray
import ray
import s3fs
import yaml
from ray import serve
from haystack.pipelines.base import Pipeline
RAY_ADDRESS=<HEAD_NODE_ADDRESS>
RAY_PORT='10001'
RAY_SERVE_PORT='8000'
# Let pyenv decide which version of python to use
# Taken from StackOverflow https://stackoverflow.com/a/70307478/788833
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
# Activate Rust
@dmigo
dmigo / cuda-availability.py
Created January 7, 2022 11:15
Checks if GPU is available on your machine
import torch
print(torch.cuda.is_available())
package main
import (
"crypto/rand"
"encoding/base32"
"net/http"
"strconv"
"github.com/gin-gonic/gin"
)
@dmigo
dmigo / docker-compose.yaml
Created May 8, 2019 21:21
Docker compose that has redis
version: '3.6'
services:
# app:
# build:
# context: ./app
# depends_on:
# - redis
# environment:
# - REDIS_HOST=redis
# ports:
@dmigo
dmigo / service.go
Created May 8, 2019 21:20
Example of gin application calling redis
package main
import "github.com/gin-gonic/gin"
import "fmt"
import "github.com/go-redis/redis"
func ExampleNewClient() {
client := redis.NewClient(&redis.Options{
Addr: "localhost:6379",
Password: "", // no password set
// Flurl will use 1 HttpClient instance per host
var person = await "https://api.com"
.AppendPathSegment("person")
.SetQueryParams(new { a = 1, b = 2 })
.WithOAuthBearerToken("my_oauth_token")
.PostJsonAsync(new
{
first_name = "Claire",
last_name = "Underwood"
})
@dmigo
dmigo / create_superset_users.py
Created November 1, 2017 14:47 — forked from pajachiet/create_superset_users.py
Scripting on Superset backend to fix bugs or automate tasks
#!/usr/bin/env python
# coding: utf8
# Script to create superset users
import pandas as pd
from sqlalchemy import create_engine
import datetime
import pexpect
import os
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render});
function preload() {
game.load.spritesheet('ship', 'assets/sprites/humstar.png', 32, 32);
game.load.image('pixel', 'http://1x1px.me/FF4D00-0.8.png');
}
var ship;