Skip to content

Instantly share code, notes, and snippets.

View zohaib055's full-sized avatar

Zohaib Ahmad zohaib055

  • Rontoo
  • United States
  • 03:24 (UTC -07:00)
  • LinkedIn in/devzohaib
View GitHub Profile
@hugowan
hugowan / gist:3096288
Created July 12, 2012 06:32
CodeIgniter cURL Elastic Search Client
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class ElasticSearch {
public $index;
function __construct($config = array('server' => 'http://localhost:9200'))
{
$this->server = $config['server'];
}
@anchetaWern
anchetaWern / php-webscraping.md
Created August 4, 2013 13:18
web scraping in php

Have you ever wanted to get a specific data from another website but there's no API available for it? That's where Web Scraping comes in, if the data is not made available by the website we can just scrape it from the website itself.

But before we dive in let us first define what web scraping is. According to Wikipedia:

{% blockquote %} Web scraping (web harvesting or web data extraction) is a computer software technique of extracting information from websites. Usually, such software programs simulate human exploration of the World Wide Web by either implementing low-level Hypertext Transfer Protocol (HTTP), or embedding a fully-fledged web browser, such as Internet Explorer or Mozilla Firefox. {% endblockquote %}

@rojan
rojan / node_crypto.js
Last active March 19, 2023 15:14
Encrypt in nodejs and decrypt in php or vice versa
var crypto = require('crypto');
var key = 'MySecretKey12345';
var iv = '1234567890123456';
var cipher = crypto.createCipheriv('aes-128-cbc', key, iv);
var decipher = crypto.createDecipheriv('aes-128-cbc', key, iv);
var text = 'plain text';
var encrypted = cipher.update(text, 'utf8', 'binary');
encrypted += cipher.final('binary');
hexVal = new Buffer(encrypted, 'binary');
@jonathanstark
jonathanstark / verify-google-recaptcha-with-php
Last active March 8, 2024 18:24
Verify Google reCAPTCHA with PHP
#
# Verify captcha
$post_data = http_build_query(
array(
'secret' => CAPTCHA_SECRET,
'response' => $_POST['g-recaptcha-response'],
'remoteip' => $_SERVER['REMOTE_ADDR']
)
);
$opts = array('http' =>
@soheilhy
soheilhy / mochatutorial.md
Last active March 18, 2022 05:23
Mocha Tutorial

Testing Node.JS applications using Mocha

Mocha is a unittest framework for Node. In this document, we explain how you can test your javascript code and also your HTTP servers.

Installing Mocha

Use npm to install Mocha:

npm install mocha
@guillaumevincent
guillaumevincent / README.md
Last active June 23, 2024 23:59
Windows Service with Python 3.5 and pyinstaller
@jamil666
jamil666 / Amazon_CloudWatch_EC2_CPU_Utilization
Created December 20, 2017 07:07
This script describe all EC2 instances from Amazon AWS and check CPU utilization. If CPU load more than 50%, it will send email to administrator
import boto3
from datetime import datetime, timedelta
from operator import itemgetter
import smtplib
from email.mime.text import MIMEText
AccessKey = "Your Access Key"
SecretKey = "Your Secret Key"
@hagemann
hagemann / database.js
Last active December 9, 2022 10:24
Promisified MySQL middleware for Node.js
const util = require('util')
const mysql = require('mysql')
const pool = mysql.createPool({
connectionLimit: 10,
host: 'localhost',
user: 'root',
password: 'password',
database: 'my_database'
})
@adylevy
adylevy / DeleteButtonWithConfirmation.js
Last active May 22, 2021 11:46
react-admin delete button with confirmation
/*
Copyright (c) 2018 Ady Levy
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@camisetags
camisetags / sortTransaction.js
Last active November 30, 2020 02:00
transactionChallenge
// from codepad
var Mocha = require('mocha')
var mocha = new Mocha()
mocha.suite.emit('pre-require', this, 'solution', mocha)
var assert = require("chai").assert;
var transacts = [
{