Skip to content

Instantly share code, notes, and snippets.

View thegoliathgeek's full-sized avatar
🗻
High on mountains, Drunk on code

Dhanush thegoliathgeek

🗻
High on mountains, Drunk on code
View GitHub Profile
@thegoliathgeek
thegoliathgeek / index.ts
Created August 28, 2024 08:37
Document intelligence extraction code in TypeScript
import * as dotenv from "dotenv";
dotenv.config();
import fs from 'fs';
import DocumentIntelligence from "@azure-rest/ai-document-intelligence";
import {
getLongRunningPoller,
AnalyzeResultOperationOutput,
isUnexpected,
} from "@azure-rest/ai-document-intelligence";
@thegoliathgeek
thegoliathgeek / smart-container.cpp
Created February 9, 2024 06:24
esp8266 https api call on sensor input
#include <Arduino.h>
#include<ESP8266HTTPClient.h>
// #include<WiFiClientSecure.h>
#include <ESP8266WiFi.h>
#include <WiFiClientSecureBearSSL.h>
HTTPClient http;
// WiFiClientSecure client;
const char* ssid = "******";
@thegoliathgeek
thegoliathgeek / random-emoji.zsh-theme
Created March 1, 2023 06:08
Random emoji zsh theme with git branch
# zsh
# Paste this in `/Users/<user>/.oh-my-zsh/themes`
EMOJI=(💩 🐦 🚀 🐞 🎨 🍕 🐭 👽 ☕️ 🔬 💀 🐷 🐼 🐶 🐸 🐧 🐳 🍔 🍣 🍻 🔮 💰 💎 💾 💜 🍪 🌞 🌍 🐌 🐓 🍄 )
function random_emoji {
echo -n "$EMOJI[$RANDOM%$#EMOJI+1]"
}
import asyncio
async def delayedHelloWorld(delay=0):
await asyncio.sleep(delay)
print('Hello World')
async def main():
await delayedHelloWorld(2)
loop = asyncio.get_event_loop()
import asyncio
if __name__ == '__main__':
loop = asyncio.get_event_loop()
server {
listen 80;
listen [::]:80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
web:
image: nginx
volumes:
- ./conf.d/default.conf:/etc/nginx/conf.d/default.conf
- ./html:/usr/share/nginx/html
ports:
- "80:80"
@thegoliathgeek
thegoliathgeek / resolver.ts
Created August 25, 2020 09:38
Graphql Subscription Resolver file
import {Ctx, Query, Resolver, Subscription} from "type-graphql";
@Resolver()
export default class SubscriptionResolver {
@Query(returns => String)
async hello(@Ctx() ctx: any) {
await ctx.req.pubsub.publish('MESSAGES');
return "Hello World"
}
cd ~/lifedata-web-v2
git pull origin develop
yarn build
sudo rm -rf /var/www/html/*
sudo cp -r build/* /var/www/html/
cd ~/efm-v2
git pull origin master
npm run restore
pm2 restart 1