Skip to content

Instantly share code, notes, and snippets.

View sahilrajput03's full-sized avatar
💭
I'm happy these days.

Sahil Rajput sahilrajput03

💭
I'm happy these days.
View GitHub Profile
# cat /etc/postfix/main.cf
smtpd_banner = $myhostname ESMTP $mail_name ($mail_version)
biff = no
append_dot_mydomain = no
readme_directory = no
compatibility_level = 2
mailbox_size_limit = 0
recipient_delimiter = + .
inet_interfaces = all
module.exports = {
data: [
{
type: 'hotel-offers',
hotel: {
type: 'hotel',
hotelId: 'XKLON321',
chainCode: 'XK',
dupeId: '501108165',
name: 'Hotel London Allocation',
@sahilrajput03
sahilrajput03 / gist:a691c18b3d8b3fc6dbca919a73dd99ba
Last active August 25, 2022 16:48
chat application in nextjs using socket.io
import io from 'socket.io-client';
import {useState, useEffect, useRef} from 'react';
import Header from 'components/header';
import Image from 'next/image';
import desiredChat from '../assets/desired-chat.png';
import Avatar from '@mui/material/Avatar';
import SendMessageIcon from '../assets/send-message-icon.png';
import MessageInputGalleryIcon from '../assets/message-input-gallery-icon.png';
import MessageInputSmileyIcon from '../assets/message-input-smiley-icon.png';
import ClientOnly from 'components/ClientOnly';
import io from 'socket.io-client';
import {useState, useEffect, useRef} from 'react';
import Header from 'components/header';
import Image from 'next/image';
import desiredChat from '../assets/desired-chat.png';
import Avatar from '@mui/material/Avatar';
import SendMessageIcon from '../assets/send-message-icon.png';
import MessageInputGalleryIcon from '../assets/message-input-gallery-icon.png';
import MessageInputSmileyIcon from '../assets/message-input-smiley-icon.png';
import ClientOnly from 'components/ClientOnly';
@sahilrajput03
sahilrajput03 / index.html
Last active August 4, 2022 13:43
rpc-demo snippet FRONTEND
<!-- File: index.html -->
<!-- In <body> of you html, you can use rpc like that -->
<div class="desc">Use below buttons to call appropriate function on server:</div>
<button onclick="btn1()">rpc.test()</button>
<button onclick="btn2()">rpc.yoy("God loves all")</button>
<button onclick="btn3()">rpc.cat({say: "meoww"})</button>
<button onclick="btn4()">rpc.love("donald", "pikachu")</button>
<button onclick="btn5()">rpc.someNonExistingFunction("pokemons")</button>
<button onclick="btn6()">rpc.rain("Charlizard", "Nobita")</button>
@sahilrajput03
sahilrajput03 / server-functions.js
Last active August 4, 2022 14:01
rpc-demo snippet
// File: server-functions.js
module.exports.test = () => 'works!'
module.exports.yoy = (message) => {
return message + ' from server..'
}
module.exports.cat = (body) => {
const {say} = body
return 'Cat says:' + say + '!!'
}
module.exports.love = (name1, name2) => {
[
{
"breed": "Affenpinscher",
"origin": "Germany",
"url": "https://en.wikipedia.org/wiki/Affenpinscher",
"img": "https://upload.wikimedia.org/wikipedia/commons/thumb/1/17/Affenpinscher.jpg/220px-Affenpinscher.jpg",
"meta": {
"height": "23–30 cm (9–12 in)",
"weight": "3–6 kg (7–13 lb)",
"coat": "Wire",
array@array-os:~/test/magnaluna$ php magna.php
PHP Warning: PHP Startup: php-libtgvoip: Unable to initialize module
Module compiled with module API=20151012
PHP compiled with module API=20190902
These options need to match
in Unknown on line 0
Deserializing MadelineProto from session.madeline...
Logger: MadelineProto
Logger: Copyright (C) 2016-2020 Daniil Gentili
Logger: Licensed under AGPLv3