Skip to content

Instantly share code, notes, and snippets.

View zohaib055's full-sized avatar

Zohaib Ahmad zohaib055

  • Rontoo
  • United States
  • 11:40 (UTC -07:00)
  • LinkedIn in/devzohaib
View GitHub Profile
@krzysztof-miemiec
krzysztof-miemiec / serverless.js
Created March 26, 2020 10:45
Some kind of stages stub to be able to use serverless-next.js in order to deploy to multiple envs
// serverless/stages/serverless.js
const { Component } = require('@serverless/core');
const required = (name) => {
throw new Error(`An argument "${name}" is required.`);
};
const processRef = (value, data) => {
for (const key in data) {
@bradtraversy
bradtraversy / scrapy.md
Last active November 30, 2022 14:05
Scrapy commands and code
@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 = [
{
@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:
@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'
})
@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"
@guillaumevincent
guillaumevincent / README.md
Last active April 28, 2024 00:51
Windows Service with Python 3.5 and pyinstaller
@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
@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' =>
@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');