Skip to content

Instantly share code, notes, and snippets.

View zohaib055's full-sized avatar
🎯
Focusing

Zohaib Ahmad zohaib055

🎯
Focusing
  • BizTech247
  • United States
  • 19:38 (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 December 1, 2024 20:34
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 December 9, 2024 14:37
Windows Service with Python 3.5 and pyinstaller
@soheilhy
soheilhy / mochatutorial.md
Last active March 20, 2025 15:36
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 July 16, 2024 17:06
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' =>
@amatellanes
amatellanes / celery.sh
Last active April 28, 2025 03:31
Celery handy commands
/* Useful celery config.
app = Celery('tasks',
broker='redis://localhost:6379',
backend='redis://localhost:6379')
app.conf.update(
CELERY_TASK_RESULT_EXPIRES=3600,
CELERY_QUEUES=(
Queue('default', routing_key='tasks.#'),