Skip to content

Instantly share code, notes, and snippets.

View gaocegege's full-sized avatar
🐮
Programming

Ce Gao gaocegege

🐮
Programming
View GitHub Profile
@zopieux
zopieux / pgvectors_sqlx.rs
Created July 10, 2024 20:08
pgvecto.rs & sqlx interrop
use std::ops::Deref;
use sqlx::encode::IsNull;
use sqlx::error::BoxDynError;
use sqlx::postgres::{PgArgumentBuffer, PgTypeInfo, PgValueRef};
use sqlx::{Decode, Encode, Postgres, Type};
/// A vector.
#[derive(Clone, PartialEq, Default)]
pub struct Vector(Vec<f32>);
@RamiKrispin
RamiKrispin / gist:fff84af2622927d82d1dd369d77e3210
Created September 19, 2022 12:26
RStudio_server_docker.sh
#!/bin/bash
# Launching RStuido server on a docker with different settings
# Basic run command to launce rocker container with RStudio Server
docker run -d -p 8787:8787 \
-e USER=rstudio -e PASSWORD=rstudio \
rocker/rstudio:4.2
# Disabling the authentication
$ oc get pods --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
openshift-apiserver-operator openshift-apiserver-operator-6db995744c-nc5pj 1/1 Running 2 6d9h
openshift-apiserver apiserver-d6dm8 1/1 Running 5 6d8h
openshift-authentication-operator authentication-operator-668f5dd5cb-px72d 1/1 Running 2 6d9h
openshift-authentication oauth-openshift-7949ccf5d-2j4dc 1/1 Running 0 36m
openshift-authentication oauth-openshift-7949ccf5d-dnzpb 1/1 Running 0 36m
openshift-cloud-credential-operator
@alexchiri
alexchiri / get-started-with-kind-in-wsl2-installation-instructions.md
Last active May 2, 2024 20:37
Get started with kind in WSL2 - installation instructions
@thomelane
thomelane / jupyter_gym_render.py
Created September 11, 2018 00:40
OpenAI Gym render in Jupyter
import gym
from IPython import display
import matplotlib
import matplotlib.pyplot as plt
%matplotlib inline
env = gym.make('Breakout-v0')
env.reset()
img = plt.imshow(env.render(mode='rgb_array')) # only call this once
for _ in range(100):
@davidhughhenrymack
davidhughhenrymack / floydhub_hook.py
Created June 26, 2018 09:09
An easy way to graph your tensorflow metric ops in FloydHub
import tensorflow as tf
import numpy as np
class FloydHubMetricHook(tf.train.SessionRunHook):
"""An easy way to output your metric_ops to FloydHub's training metric graphs
This is designed to fit into TensorFlow's EstimatorSpec. Assuming you've
already defined some metric_ops for monitoring your training/evaluation,
this helper class will compute those operations then print them out in
@ZenGround0
ZenGround0 / client.go
Created January 3, 2018 20:26
Golang HTTP multipart streaming
package main
import (
"io"
"mime/multipart"
"net/http"
"net/url"
"os"
"fmt"
)
int[][] result;
float t, c;
float ease(float p) {
return 3*p*p - 2*p*p*p;
}
float ease(float p, float g) {
if (p < 0.5)
return 0.5 * pow(2*p, g);
@thockin
thockin / nginx.conf
Last active March 21, 2023 11:00
Idea: nginx vanity domain fronting gcr.io
# This is a GCR vanity domain. It aliases our domain to a specific
# bucket in GCR.
# e.g.`docker pull gcr.example.com/foobar` -> gcr.io/my_bucket/foobar
server {
server_name gcr.example.com;
listen 80;
listen 443 ssl;
location = /v2/ {
# If we redirect this, it can detect as unauthorized, but the token
@lyastro
lyastro / readme.md
Last active January 7, 2024 15:28
install Tensorflow with GPU support on Centos 7

install Tensorflow with GPU support on Centos 7

system: fully installed Centos 7

  • system update
$ sudo yum -y update
$ sudo yum -y install epel-release
$ sudo yum -y install gcc gcc-c++ python-pip python-devel atlas atlas-devel gcc-gfortran openssl-devel libffi-devel