Skip to content

Instantly share code, notes, and snippets.

View dbjpanda's full-sized avatar

Dibyajyoti Panda dbjpanda

View GitHub Profile
@mnemotiv
mnemotiv / chatgpt-api-gpt-3.5-turbo-messages-token-calculator.ts
Last active June 10, 2023 17:28
Node.js/TypeScript: ChatGPT API (gpt-3.5-turbo) messages token calculator
// Author: mnemotiv
// Donate: https://donate.stripe.com/9AQbJM4xC62P0xieUU
// Don't forget to run this first:
// npm i @dqbd/tiktoken
import { get_encoding } from '@dqbd/tiktoken';
import type { ChatCompletionRequestMessage } from 'openai';
const countTokens = (messages: ChatCompletionRequestMessage[]): number => {
@dbjpanda
dbjpanda / transfer.ps1
Last active November 15, 2019 06:35
Domain transfer from other registrar to Azure . Copy below snippets and paste it on Azure Cloud Shell here https://shell.azure.com/?prompt=True
$ResourceLocation = "Global"
$ResourceName = "outingbay.com" #user's domain (constoso.com)
$ResourceGroupName = "outingbay" # This should be an existing resource group in your Azure subscription
$PropertiesObject = @{
'Consent' = @{
'AgreementKeys' = @("DNPA","DNTA");
'AgreedBy' = '10.5.50.11'; #user's IP address (192.168.1.1)
'AgreedAt' = '2019-11-15 10:17:42Z'; #roughly the current time (2017-13-05T12:25:30.6850404Z)
};
'authCode' = '<The code you received from other registrar>'; #code obtained from their current provider in order to transfer out the domain
@iqbalrony
iqbalrony / custom-css.php
Last active November 22, 2023 11:56
How to add custom css control with elementor free version.
<?php
use Elementor\Controls_Manager;
use Elementor\Element_Base;
use Elementor\Core\Files\CSS\Post;
use Elementor\Core\DynamicTags\Dynamic_CSS;
// Exit if accessed directly
if (!defined('ABSPATH')) {
exit;
@danyj
danyj / ThzelGetElementSettings.php
Created May 17, 2019 11:41
Pull any Elementor options outside of Elementor
/**
* @package Thz Framework
* @author Themezly
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
* @websites http://www.themezly.com | http://www.youjoomla.com | http://www.yjsimplegrid.com
*/
class ThzelGetElementSettings {
@darkoromanov
darkoromanov / freemius-2-fomo.php
Last active July 22, 2021 17:58
Freemius integration for Fomo
<?php
// Fomo documentation: https://docs.fomo.com/reference
// Freemius documentation: http://freemius.com/help/documentation/marketing-automation/events-webhooks/
// Install Fomo PHP SDK https://github.com/usefomo/fomo-php-sdk
include "vendor/autoload.php";
define("FOMO_AUTH_TOKEN", "*********");
@dbjpanda
dbjpanda / install.sh
Created March 12, 2018 04:46
Script to install Drupal 8 on top of Digitalocean LEMP server.
chmod +x d8.sh
yes "yes" | ./d8.sh
#!/bin/bash
sudo apt-get purge php.*
sudo rm -rf /etc/php
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
#!/bin/bash
set -o errexit
# Address of the registry that we'll be
# performing the inspections against.
# This is necessary as the arguments we
# supply to the API calls don't include
# such address (the address is used in the
# url itself).
@chrisguitarguy
chrisguitarguy / menu-order.php
Created October 20, 2011 15:57
Add menu order to WordPress posts
<?php
/*
Plugin Name: Add Menu Order to Posts
Plugin URI: http://pmg.co/category/wordpress
Description: Adds menu order and template to post types.
Version: n/a
Author: Christopher Davis
Author URI: http://pmg.co/people/chris
*/