Skip to content

Instantly share code, notes, and snippets.

View gowrishankarin's full-sized avatar
🎯
Focusing

Gowri Shankar gowrishankarin

🎯
Focusing
View GitHub Profile
@gowrishankarin
gowrishankarin / requirements.txt
Created March 17, 2024 15:30
TruLens Eval - Environment for Evaluating TruEra LLM eval modules
absl-py @ file:///home/conda/feedstock_root/build_artifacts/absl-py_1705494584803/work
aiobotocore @ file:///home/conda/feedstock_root/build_artifacts/aiobotocore_1709590248257/work
aiofiles==23.2.1
aiohttp @ file:///Users/runner/miniforge3/conda-bld/aiohttp_1707669852329/work
aioitertools @ file:///home/conda/feedstock_root/build_artifacts/aioitertools_1663521246073/work
aiosignal @ file:///home/conda/feedstock_root/build_artifacts/aiosignal_1667935791922/work
alabaster @ file:///home/conda/feedstock_root/build_artifacts/alabaster_1704848697227/work
alembic==1.13.1
altair @ file:///home/conda/feedstock_root/build_artifacts/altair_1701735522225/work
annotated-types @ file:///home/conda/feedstock_root/build_artifacts/annotated-types_1696634205638/work
@gowrishankarin
gowrishankarin / loss.py
Last active December 29, 2021 05:32
Loss for VAE of 1d array
def build_encoder_with_sampling_layer(shape=(6)):
encoder_inputs = keras.layers.Input(shape=shape, name="input_layer")
x = keras.layers.Dense(5, activation="relu", name="h1")(encoder_inputs)
x = keras.layers.Dense(5, activation="relu", name="h2")(x)
x = keras.layers.Dense(4, activation="relu", name="h3")(x)
z_mean = keras.layers.Dense(latent_dim, name="z_mean")(x)
z_log_var = keras.layers.Dense(latent_dim, name="z_log_var")(x)
z = Sampling()([z_mean, z_log_var])
<script
type="text/javascript"
async
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML"
></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
processEscapes: true
@gowrishankarin
gowrishankarin / jaddu_rocks.py
Last active August 13, 2021 14:37
Jaddu Rocks
scores = ["81", "58", "1*", "16", "30*", "40", "91", "51", "60*",
"12", "9", "16*", "57", "28*", "15", "16", "56", "40"]
notouts = [
1 if a_score.find("*") != -1 else 0 for a_score in scores
]
outs = (len(scores) - sum(notouts))
total_score = sum([
int(score.split("*")[0]) if is_out else int(score) for score, is_out in zip(scores, notouts)
])
print(f'Jaddu\'s Average in the last {len(scores)} innings is {total_score/outs}')
@gowrishankarin
gowrishankarin / gnome3_failure.txt
Created February 10, 2017 05:30
Gnome3 Failure
1. **Don't panic!**
2. If your computer is hanged over login screen, press Crtl+Alt+f2
3. It will ask for your login username and password.
4. Connect ethernet cable (LAN cable) from your wifi router or modem to your computer
4. Type "dhclient eth0" and press enter
5. For testing networking, try "ping www.google.com" if there's any failure then please check your lan connection,router or modem (
Connecting to WiFi is a tedious process so prefer LAN connection)
6. Type "reboot" (without quotes) and press enter.
7. Now keep pressing "Esc" or "Shift" key.
8. Enter into latest kernel recovery mode.
# https://www.kaggle.com/c/grupo-bimbo-inventory-demand/discussion/23863#136641
library(data.table)
library(xgboost)
train = fread('_data/train.csv', select=c("Semana", 'Cliente_ID', 'Producto_ID',
'Agencia_ID', 'Ruta_SAK', 'Demanda_uni_equil'))
test = fread('_data/test.csv', select=c("Semana", 'id', 'Cliente_ID', 'Producto_ID',
'Agencia_ID', 'Ruta_SAK'))
@gowrishankarin
gowrishankarin / preceptron.R
Created January 30, 2017 05:39
Multi Layer Perceptron
library((neuralnet)
library(NeuralNetTools)
CAPITAL_LETTER <- c(rep(0, 7), 1)
SMALL_LETTER <- c(0, rep(1, 7))
binaryData <- data.frame(
expand.grid(c(0, 1), c(0, 1), c(0, 1)), CAPITAL_LETTER, SMALL_LETTER
)
colnames(binaryData) <- c("X_Points", "Y_Points", "Velocity", "CAPITAL_LETTER", "SMALL_LETTER")
mod <- neuralnet(
CAPITAL_LETTER + SMALL_LETTER ~ X_Points + Y_Points + Velocity,
@gowrishankarin
gowrishankarin / media.queries.css
Last active November 28, 2016 10:31
Media Queries Sample
@media screen and (min-width: 1px) and (max-width: 400px) {
/*
This seems like a good place for code... Make sure you change the breakpoints!
*/
body {
background: #ff0000;
}
}
@media screen and (min-width: 401px) and (max-width: 599px) {
@gowrishankarin
gowrishankarin / ampq.js
Created November 27, 2016 10:00
NodeJS AMQP Connector and Receiver
function startAMQPReceiver() {
amqp.connect('amqp://' + CustomConfig.CC.aims.domain).then(function(conn) {
process.once('SIGNT', function() {
conn.close();
});
return conn.createChannel().then(function(ch) {
var ok = ch.assertQueue('heartspots', {
durable: true
});
const fs = require('fs');
const http = require('http');
const crypto = require('crypto');
const image_location = 'some-image-in-current-folder.jpg';
const config = {
recognizeIm: {
clientId: '',
apiKey: '',