Skip to content

Instantly share code, notes, and snippets.

View sachitsac's full-sized avatar
💭
Learning react and AWS CDK

Sachit sachitsac

💭
Learning react and AWS CDK
View GitHub Profile
@sachitsac
sachitsac / opensearch-compose-generate.sh
Created June 14, 2024 16:56 — forked from dtaivpp/opensearch-compose-generate.sh
This is a shell script for setting up a single node cluster for OpenSearch. This is something you can use in local development. It creates a secret password that is random every time.
#!/bin/bash
# 1. To run this script curl it locally:
# curl https://gist.githubusercontent.com/dtaivpp/c587d99a2cab441eba0314534ae87c86/raw -o opensearch-compose-bootstrap.sh
# 2. Change it to be executable:
# chmod +x opensearch-compose-generate.sh
# 3. Run it:
# ./opensearch-compose-generate.sh
#
# This will create:
# - docker-compose.yml file for OpenSearch
@sachitsac
sachitsac / zod-external-api-example-no-validation.ts
Created January 11, 2023 11:13
How to add runtime type safety using zod when using external api's
interface User {
id: number;
name: string;
email: string;
address?: string;
}
interface GetUserByIdParams {
id: User["id"];
filter: { [k in keyof User]: User[k] };
export const mockedCorrectUser = {
name: "abc",
uuid: "b3963682-08f1-4946-b832-3b7fe4d45f6c",
email: "[email protected]",
verified: true,
};
export const invalidUser = {
name: "abc",
uuid: "abc",
{
kpireferences: {
prefixes: {
http: //api.clearsight.co/ontology/Wolverine: "O0",
http: //apidev.clearsight.co/data/tellmeharrysachit: "D0"
},
access: [
],
data: {
@sachitsac
sachitsac / gist:49d42d5a6ef7d158d1a0
Last active August 29, 2015 14:08
GIT Change log generator for a provided period
#!/bin/bash
START=$1
END=$2
if [[ "$#" -ne 2 ]]; then
echo -e "Proved a start and end time using this fromat: YYYY-MM-D";
exit;
fi
@sachitsac
sachitsac / XHProf
Created November 29, 2013 13:31
Install Xhprof on ubuntu 12.04 and enable the web interface using an alias /profiling
#!/bin/bash
sudo apt-get install php-pear
sudo pear upgrade pear
sudo pecl install xhprof-beta
sudo apt-get install graphviz
sudo cp /etc/php5/apache2/php.ini /etc/php5/apache2/php.ini_original
sudo cp /etc/php5/apache2/php.ini /tmp
@sachitsac
sachitsac / GitPullPush
Created November 28, 2013 09:00
Git Pull and Push in one line
#!/bin/bash
if [ $# -ne 3 ]
then
echo -e "Usage gitpush [remote_branch] [branch_name] [commit_message]"
echo -e "eg: gitpush origin master 'Some commit message'"
exit
fi
git add .