Skip to content

Instantly share code, notes, and snippets.

View saiccoumar's full-sized avatar

Sai Coumar saiccoumar

View GitHub Profile
...
extern int
__vfprintf (FILE *fp, const char *format, va_list ap)
{
return __vfprintf_internal (fp, format, ap, 0);
}
// source: https://github.com/bminor/glibc/blob/master/stdio-common/vfprintf.c
...
@saiccoumar
saiccoumar / printf.c
Last active January 12, 2024 21:14
printf
...
int
__printf (const char *format, ...)
{
va_list arg;
int done;
va_start (arg, format);
done = __vfprintf_internal (stdout, format, arg, 0);
va_end (arg);
@saiccoumar
saiccoumar / fit_tanh.py
Last active July 21, 2024 05:20
Fitting the tanh function
import pandas as pd
import numpy as np
from scipy.optimize import curve_fit
import matplotlib.pyplot as plt
import sympy as sp
from pandas.plotting import table
@saiccoumar
saiccoumar / test.py
Created January 5, 2024 05:35
OpenCV with virtual cameras
import cv2
# Replace 1 with whatever camera you want
cap = cv2.VideoCapture(1)
if not cap.isOpened():
print("Error: Could not open camera.")
exit()
cap.set(cv2.CAP_PROP_FRAME_WIDTH, 640)
@saiccoumar
saiccoumar / available_cameras.py
Created January 5, 2024 05:14
available cameras
import cv2
def get_available_cameras():
available_cameras = []
# Check for 5 cameras
for i in range(5):
cap = cv2.VideoCapture(i)
if cap.isOpened():
available_cameras.append(i)
cap.release()
@saiccoumar
saiccoumar / example of passing arguments with OOP
Last active October 27, 2022 01:27
Object Oriented Programming Dummy Code
//Imagine these variables are publicly accessible or getters exist and I'm using those
public Fruit(String name, String color, String taste, boolean healthy, int size, float calories) {
this.name = name;
this.color = color;
this.taste = taste;
this.healthy = healthy;
this.size = size;
this.calories = calories;
}
@saiccoumar
saiccoumar / index.js
Last active May 25, 2022 21:22
API practice
//imports
var express = require("express"),
app = express(),
mongoose = require("mongoose"),
port = 8000,
url ="mongodb://localhost:27017/api";
//sets the view engine to html, need to change if want to use ejs
mongoose.connect(url, {
useNewUrlParser: true,
useUnifiedTopology: true
@saiccoumar
saiccoumar / Client.java
Created May 25, 2022 16:26
Simple Client/Server in Java
import java.io.*;
import java.net.*;
import java.util.Scanner;
public class Client {
public static void main(String[] args) throws UnknownHostException, IOException, ClassNotFoundException {
Scanner scan = new Scanner(System.in);