Skip to content

Instantly share code, notes, and snippets.

View sanchitrk's full-sized avatar
😎
Building

Sanchit Rk sanchitrk

😎
Building
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sanchitrk
sanchitrk / conventional_commit_messages_cheatsheet.md
Created June 14, 2024 13:00 — forked from qoomon/conventional-commits-cheatsheet.md
Conventional Commit Messages - Cheatsheet

Conventional Commit Messages

See how a minor change to your commit message style can make a difference.

Tip

Have a look at git-conventional-commits , a CLI util to ensure these conventions and generate verion and changelogs

Commit Message Formats

Default

@sanchitrk
sanchitrk / gpt4_abbreviations.md
Created May 25, 2024 04:42 — forked from VictorTaelin/gpt4_abbreviations.md
Notes on the GPT-4 abbreviations tweet

Notes on this tweet.

  • The screenshots were taken on different sessions.

  • The entire sessions are included on the screenshots.

  • I lost the original prompts, so I had to reconstruct them, and still managed to reproduce.

  • The "compressed" version is actually longer! Emojis and abbreviations use more tokens than common words.

@sanchitrk
sanchitrk / google-oauth.js
Created July 31, 2021 19:36 — forked from jhackett1/google-oauth.js
Using Google oAuth to authenticate a React app and Express API
////////////
// REACT APP
////////////
// Your login screen
<GoogleLogin
clientId={process.env.REACT_APP_GOOGLE_CLIENT_ID}
buttonText="Sign in with Google"
className="ct-button ct-button--secondary"
import React from 'react';
import PropTypes from 'prop-types'
import debounce from 'lodash.debounce' // or whatevs
import isEqual from 'lodash.isEqual'
class AutoSave extends React.Component {
static contextTypes = {
formik: PropTypes.object
}
import random
import time
import numpy
from exceptions import ValueError
class PushID(object):
# Modeled after base64 web-safe chars, but ordered by ASCII.
PUSH_CHARS = ('-0123456789'
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
@sanchitrk
sanchitrk / generate-pushid.js
Created May 11, 2020 11:12 — forked from mikelehen/generate-pushid.js
JavaScript code for generating Firebase Push IDs
/**
* Fancy ID generator that creates 20-character string identifiers with the following properties:
*
* 1. They're based on timestamp so that they sort *after* any existing ids.
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs.
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly).
* 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the
* latter ones will sort after the former ones. We do this by using the previous random bits
* but "incrementing" them by 1 (only in the case of a timestamp collision).
*/
@sanchitrk
sanchitrk / __init__.py
Created June 18, 2019 04:55 — forked from theorm/__init__.py
Pluggable API using Flask MethodView.
# -*- coding: utf-8 -*-
from .bananas import Bananas
from .base import the_api
the_api.add_url_rule('/bananas', view_func=Bananas.as_view('bananas'))
the_api.add_url_rule('/farm/<farm_id>/bananas', view_func=Bananas.as_view('bananas_from_a_farm'))
__all__ = [
@sanchitrk
sanchitrk / counter_test.py
Created December 4, 2018 08:06 — forked from dpifke/counter_test.py
Performance comparison of defaultdict vs. Counter and tuple vs. namedtuple in Python
#!/usr/bin/python
#
# Copyright (c) 2012 Dave Pifke.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@sanchitrk
sanchitrk / config.py
Created September 17, 2018 05:45 — forked from dimmg/config.py
fabric + gunicorn + upstart + nginx
HOST = '172.39.10.30'
PROJECTS_DIR = '/home/exampleuser/'
USER = 'exampleuser'
PROJECT_NAME = 'example'
APP_DIR = '{0}{1}/'.format(PROJECTS_DIR, PROJECT_NAME)
VIRTUALENVS_DIR = '{0}.virtualenvs/'.format(PROJECTS_DIR)
VIRTUALENV_PATH = '{0}{1}/'.format(VIRTUALENVS_DIR, PROJECT_NAME)
LOGS_DIR = '{0}logs/'.format(APP_DIR)
REPOSITORY = '[email protected]:example-team/example.git'
BRANCH = 'master'