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
maps.google.com/?q=lat,lon | |
maps.google.com/?q=22.215331111111112,88.12334222222222 |
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
// Install Typescript at Global Scope | |
npm install -g typescript | |
// Prints Current Version Tsc | |
tsc -v | |
// Create the tsconfig.json | |
tsc --init | |
// Create build |
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 { tz } from "moment-timezone" | |
export function IstTimeStrToGmtTimeStr(timeZone: string, h: number, m: number) { | |
const time = { hour: h, minutes: m } | |
const timeon = timeZone.split(' ')[1] | |
tz.setDefault("Etc/UTC") | |
let user_time = tz(time, timeon).utc().format("HH:mm:ss") //("HH:MM:SS") will not work |
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 redis = require("redis") | |
async function main() { | |
const client = redis.createClient({ | |
socket: { | |
host: "redis.com", | |
port: 1338 | |
}, |
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
npm install dotenv | |
JS ==> require('dotenv').config() | |
TS ==> import 'dotenv/config' | |
process.env.PORT |
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
# Signup into ibm cloud and get your free api keys | |
# pip install ibm_watson | |
apikey = 'YOUR WATSON API KEY HERE' | |
url = 'YOUR WATSON URL HERE' | |
input_text ='Wir sinken.' | |
# Authenticate | |
authenticator = IAMAuthenticator(apikey) | |
tts = TextToSpeechV1(authenticator=authenticator) |
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
https://stackoverflow.com/questions/12343984/insert-trigger-to-update-another-table-using-postgresql | |
Here we have two tables named table1 and table2. Using a trigger I'll update table2 on insertion into table1.\ | |
Create the tables: | |
CREATE TABLE table1 | |
( | |
id integer NOT NULL, | |
name character varying, | |
CONSTRAINT table1_pkey PRIMARY KEY (id) |
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
package main | |
import ( | |
"fmt" | |
"log" | |
"net/smtp" | |
// "os" | |
) | |
func sendMail() { |
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 { createTransport } from "nodemailer"; | |
async function sendMail( msg: string) { | |
var transporter = createTransport({ | |
service: 'gmail', | |
auth: { | |
user: GetMailUserId(), | |
pass: GetMailPass() | |
} | |
}); |
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
npm i bcrypt@5.0.1 @types/bcrypt@3.0.0 | |
import * as bcrypt from "bcrypt" | |
function getHash(password: string): string { | |
const saltRounds = bcrypt.genSaltSync(12) | |
const hash = bcrypt.hashSync(password,saltRounds) | |
return hash | |
} |
NewerOlder