Skip to content

Instantly share code, notes, and snippets.

View alirezaAsadi2018's full-sized avatar
🎯
Doing some hard work

Alireza Asadi alirezaAsadi2018

🎯
Doing some hard work
  • Cafebazaar
  • Tehran, Iran
View GitHub Profile
@pszemraj
pszemraj / inference_openai.py
Last active March 10, 2025 08:10
basic openai chat completion example
"""
inference_openai.py - text generation with OpenAI API
See https://platform.openai.com/docs/quickstart for more details.
Usage:
python inference_openai.py --prompt "The quick brown fox jumps over the lazy dog." --model "gpt-3.5-turbo" --temperature 0.5 --max_tokens 256 --n 1 --stop "."
Detailed usage:
python inference_openai.py --help
@noslin005
noslin005 / ofed-ubuntu.sh
Created June 23, 2021 12:31
Install Mellanox Ofed on Ubuntu Machines
#!/bin/bash
# ofed-ubuntu.sh
# Install Mellanox Ofed on Ubuntu Machines
#
# Author: Nilson Lopes (06/17/2021)
ubuntu_release=$(awk -F '"' '/VERSION_ID/ {print $2}' /etc/os-release)
mofed_package_version='latest'
mofed_repo_base_url="https://linux.mellanox.com/public/repo/mlnx_ofed"
@flaviocopes
flaviocopes / check-substring-starts-with.go
Last active June 23, 2024 09:05
Go: check if a string starts with a substring #golang
package main
import (
"strings"
)
func main() {
strings.HasPrefix("foobar", "foo") // true
}
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],