Skip to content

Instantly share code, notes, and snippets.

@Uplink03
Uplink03 / bash-programming-showcase.bash
Created September 15, 2022 23:55
Bash programming(!) language
#!/bin/bash
# This file is supposed to give you a quick idea about what Bash can do beyond its regular job as a shell or scripting language.
# Bash is more than a scripting language. It's a half-decent programming language. It's snail slow, but half-decent otherwise.
# While it's very archane for such usage, it can be a good substitute for Perl and Python in a pinch.
# These things won't work on cut down shells (e.g. sh, ash, dash), and may explode on ZSH, which has its own,
# somewhat friendlier(!), more modern(!) ways of doing these things.
# Remember kids: always quote your variables in Bash! You're almost certainly expecting them to expand
# Mathieu Blondel, 2022
# BSD license
import numpy as np
from scipy.ndimage import convolve1d
from sklearn.metrics.pairwise import euclidean_distances
def smoothed_conjugate_conv(f, x, eps=1.0):
"""
@Praneet9
Praneet9 / convert_to_coco.py
Last active October 28, 2023 16:42
Convert Dataset to COCO Format
import json
import os
TRAIN_PATH = 'PCBData/PCBData/trainval.txt'
TEST_PATH = 'PCBData/PCBData/test.txt'
def create_data(data_path, output_path):
images = []
anns = []
@RanjanSushant
RanjanSushant / weather_scraping_demo.py
Last active December 20, 2021 00:04
Codesphere web scraping with Python example
#------- Importing required libraries --------
import pandas as pd
import requests
from bs4 import BeautifulSoup
#------- URL of the WEBPAGE you want to SCRAPE --------------
url = "https://forecast.weather.gov/MapClick.php?lat=41.8843&lon=-87.6324#.YbH0ptBBxPY"
#------- Sending an HTTP request ----------
response = requests.get(url)
@mrange
mrange / README.md
Last active January 12, 2025 03:23
# F# Advent 2021 Dec 08 - Fast data pipelines with F#6

F# Advent 2021 Dec 08 - Fast data pipelines with F#6

Thanks to Sergey Tihon for running F# Weekly and F# Advent.

Thanks to manofstick for trying out the code and coming with invaluable feedback. Cistern.ValueLinq is very impressive.

TLDR; F#6 enables data pipelines with up to 15x less overhead than LINQ

There were many interesting improvements in F#6 but one in particular caught my eye, the attribute InlineIfLambda.

@shawwn
shawwn / What happens when you allocate a JAX tensor on a TPU.md
Last active April 15, 2023 04:11
JAX C++ stack trace walkthrough for TpuExecutor_Allocate
using System;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleApp
{
public static class Program
{
static void Main(string[] args)
{
@bhavsarpratik
bhavsarpratik / gpt3_inference.py
Last active February 16, 2024 13:12
OpenaAI GPT3 inference
# pip install openai retry
import openai
from retry import retry
model="curie:ft-xxx-2021-01-09-19-21-20
@retry(Exception, tries=3, delay=10)
def get_gpt_reason(prompt, model, prob=False, max_tokens=10):
import pandas as pd
import matplotlib.pyplot as plt
import pytz
import datetime as dt
from datetime import date
import streamlit as st
#st.set_option('deprecation.showPyplotGlobalUse', False)
import numpy as np
import os
import alpaca_trade_api as tradeapi
@cunhafh
cunhafh / smileDetector.py
Last active August 10, 2021 21:20
Smile detection
import cv2
import dlib
def faceLandmarks(im):
# Path for the detection model, you can download it from here: https://github.com/italojs/facial-landmarks-recognition/blob/master/shape_predictor_68_face_landmarks.dat
PREDICTOR_PATH = r"C:\Users\felipe.cunha\Documents\venv\cv2\week1-pyton\data\models\shape_predictor_68_face_landmarks.dat"
# Create object to detect the face