Skip to content

Instantly share code, notes, and snippets.

View YugalXD's full-sized avatar
💭
yugalxd@github:~$ profile

Yugal Yadav YugalXD

💭
yugalxd@github:~$ profile
View GitHub Profile
@YugalXD
YugalXD / send-receive-sqs.php
Last active April 18, 2017 17:41 — forked from fbrnc/send-receive-sqs.php
Sending and receiving messages from/to AWS SQS via PHP
<?php
// curl -sS https://getcomposer.org/installer | php
// php composer.phar require aws/aws-sdk-php
// export AWS_ACCESS_KEY_ID=...
// export AWS_SECRET_ACCESS_KEY=...
$queueUrl = '<INSERT_URL_OF_EXISTING_QUEUE_HERE>';
@YugalXD
YugalXD / LetsEncrypt.md
Created March 16, 2017 07:52 — forked from davestevens/LetsEncrypt.md
Let’s Encrypt setup for Apache, NGINX & Node.js

Let's Encrypt

Examples of getting certificates from Let's Encrypt working on Apache, NGINX and Node.js servers.

Obtain certificates

I chose to use the manual method, you have to make a file available to verify you own the domain. Follow the commands from running

git clone https://github.com/letsencrypt/letsencrypt
cd letsencrypt
@YugalXD
YugalXD / s3_rackspace_migrate.py
Created February 22, 2017 12:21 — forked from tony-landis/s3_rackspace_migrate.py
Migrate from S3 to Rackspace Cloud Files
#!/usr/bin/python
"""
S3 to Rackspace Cloud Files Migration
This script will copy the contents of a S3
bucket to to a Rackspace Cloud Files container.
Depends on the boto and python_cloudfiles python libraries.
@YugalXD
YugalXD / multi-git.md
Created January 16, 2017 12:58 — forked from rosswd/multi-git-win.md
Setting up a Github and Bitbucket account on the same computer.

Setting up github and bitbucket on the same computer

Github will be the main account and bitbucket the secondary.

Create SSH Keys

ssh-keygen -t rsa -C "github email"

Enter passphrase when prompted. If you see an option to save the passphrase in your keychain, do it for an easier life.

# check for updates
sudo apt-get update
sudo apt-get upgrade
# install necessary software
sudo apt-get install mysql-server apache2 php5 libapache2-mod-php5 php5-mysql libapache2-mod-auth-mysql php5-curl git sendmail
sudo apt-get install php-apc
# create DB
echo "CREATE DATABASE OpenVBX; GRANT ALL PRIVILEGES ON OpenVBX.* TO ubuntu@localhost IDENTIFIED BY {PASSWORD_HERE}; FLUSH PRIVILEGES" | sudo mysql -p

#MongoDB - Setting up a Replica Set

cd \mongodbdir\

mkdir db1
mkdir db2
mkdir db3

###Primary mongod --dbpath ./db1 --port 30000 --replSet "demo"

@YugalXD
YugalXD / ejabberd.yml
Last active May 25, 2016 12:47
ejabberd configuration file by webmasters.help
###
###' ejabberd configuration file
###
###
### The parameters used in this configuration file are explained in more detail
### in the ejabberd Installation and Operation Guide.
### Please consult the Guide in case of doubts, it is included with
### your copy of ejabberd, and is also available online at
### http://www.process-one.net/en/ejabberd/docs/
@YugalXD
YugalXD / maindb.sql
Created May 25, 2016 10:54
EJABBERD mysql
CREATE TABLE users (
username varchar(191) PRIMARY KEY,
password text NOT NULL,
created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- To support SCRAM auth:
-- ALTER TABLE users ADD COLUMN serverkey text NOT NULL DEFAULT '';
-- ALTER TABLE users ADD COLUMN salt text NOT NULL DEFAULT '';
@YugalXD
YugalXD / bulkmailbymailgun.php
Created April 27, 2016 06:12
Send bulk mail by mailgun api in php
<?php
define('MAILGUN_URL', 'https://api.mailgun.net/v3/DOMAIN_NAME');
define('MAILGUN_KEY', 'KEY');
function sendBulkMailByMailGun($emailArr = array(), $subject, $html, $text = '', $replyto = EMAIL_INFO, $mailcat = 'test', $mailfrom = FROM, $mailfromname = FROMNAME) {
$emails_arr = array();
if ($emailArr) {
$i=1;
foreach ($emailArr as $email) {
@YugalXD
YugalXD / function.php
Created April 26, 2016 10:04
Send mail with mailgun api by PHP CURL.
<?php
define('MAILGUN_URL', 'https://api.mailgun.net/v3/DOMAIN_NAME');
define('MAILGUN_KEY', 'KEY');
function sendmailbymailgun($to,$toname,$mailfromnane,$mailfrom,$subject,$html,$text,$tag,$replyto){
$array_data = array(
'from'=> $mailfromname .'<'.$mailfrom.'>',
'to'=>$toname.'<'.$to.'>',
'subject'=>$subject,
'html'=>$html,