View discord.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Webhook, MessageBuilder } from 'discord-webhook-node'; | |
export type IDiscord = { link?: string, title?: string, author?: string, message?: string } | |
async sendToDiscord(payload: IDiscord) { | |
// send to discord | |
const { link, title, author, message } = payload; | |
try { | |
const hook = new Webhook(link); | |
const embed = await new MessageBuilder() |
View main.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
# Load the data from the CSV file into a DataFrame | |
file_path = "data.csv" # Replace with the actual path to your CSV file | |
df = pd.read_csv(file_path) | |
# Get user input for the search criteria | |
search_input = input("Enter the value you want to search for: ") | |
# Filter the DataFrame based on the search criteria |
View self.decorator.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { SetMetadata } from '@nestjs/common'; | |
export interface SelfDecoratorParams { | |
userIDParam: string; | |
allowAdmins?: boolean; | |
} | |
export const Self = (params: SelfDecoratorParams | string) => | |
SetMetadata( | |
'selfParams', |
View crypto-rate.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from "axios" | |
const COINGGECKO_BASE_URL:string = 'https://api.coingecko.com/api/v3' | |
const VS_CURRENCY: string = "usd" | |
const CURRENCY_IDS:string = "bitcoin,ethereum,ripple,stellar,celo" | |
const ORDER:string = "market_cap_desc" | |
const PERPAGE:number = 100 | |
const PAGE = 1 | |
const SPARKLINE:boolean = false |
View axios.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable, Logger } from "@nestjs/common"; | |
import axios from "axios"; | |
import { IHttpServices } from "src/core/abstracts/http-services.abstract"; | |
@Injectable() | |
export class AxiosService implements IHttpServices { | |
async get(url: string, config: Record<string, any>) { | |
try { | |
const response = await axios.get(url, config) |
View eventEmitter.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/******** | |
* This module will help us decouple alot of functionality like | |
* * sending emails | |
* * sending sms | |
* * sending notification | |
* * tracking users activities | |
* | |
*/ | |
import * as events from "events" |
View firebaseFineOne.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type FilterQuery<T> = { | |
[K in keyof T]?: T[K] | |
}; | |
static async findOne(field: FilterQuery<ITranslation>): Promise<any> { | |
try { | |
const results = await this.builder().where(Object.keys(field)[0], "==", Object.values(field)[0]).get(); | |
if (results.length) { | |
return results[0]; | |
} |
View IRepository.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { AxiosResponse } from "axios"; | |
import { AxiosConfig } from "../../api"; | |
export interface IRead<T> { | |
getAll(route: string, params?: string): Promise<AxiosResponse<T[]>>; | |
getById(route: string, id: string): Promise<AxiosResponse<T>>; | |
getPaginatedList(route: string, params?: string): Promise<AxiosResponse<T[]>>; | |
} | |
export interface IWrite<T> { |
View hash.cfml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfoutput> | |
#hash("Password1!", "SHA-512", "UTF-8")# | |
</cfoutput> | |
# output - ECB3548B49FEFA9C984EC134FA362B3316EC8CC4C044B3A71444EED538ECC39461FE5D4DD1D71287FCD2B1C3354CC36873956B3E15229B5ACBDACDA276BABED1 | |
View encrypt.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const osbEncryption = (str: string | Record<string, any>) => { | |
console.log("STRING",str) | |
const reverseString = str.split("").reverse().join("") | |
console.log("REVERSE STRING", reverseString) | |
let hmac = crypto.createHash("sha512"); | |
hmac.update(typeof reverseString === 'string' ? reverseString : JSON.stringify(reverseString)); | |
return Buffer.from(hmac.digest()).toString('hex') | |
} |
NewerOlder