Skip to content

Instantly share code, notes, and snippets.

View itsDiwaker's full-sized avatar

Diwaker Tripathi itsDiwaker

  • envistaInteractive
  • Bengaluru, India
View GitHub Profile
@sjlu
sjlu / Migrating from Amazon Linux to Amazon Linux 2 with Elastic Beanstalk and Node.js.md
Last active September 12, 2023 08:56
Migrating from Amazon Linux to Amazon Linux 2 with Elastic Beanstalk and Node.js

This file is a log of everything I've encountered when trying to migrate a Node.js, Elastic Beanstalk application from the Amazon Linux platform to the Amazon Liunx 2 platform. Here's why you should migrate:

  1. LTS support up to 2023 source
  2. The Amazon Linux AMI's end-of-life is December, 2020 source
  3. Amazon Linux 2 has some big package upgrades (GCC, Glibc, etc.)
  4. Elastic Beanstalk also has some upgrades on top of Amazon Linux 2 (e.g. faster deploys)

Challenges

Disabling NPM install

$ awk -v ORS='\\n' '1' karnov-review.2019-01-21.private-key.pem | pbcopy
@marcuslindfeldt
marcuslindfeldt / mockVisit.js
Created July 30, 2018 12:43
Cypress PollyJS fetch mock
const uuidV4 = require('uuid/v4');
import { Polly } from '@pollyjs/core';
import FetchAdapter from '@pollyjs/adapter-fetch';
import LocalStoragePersister from '@pollyjs/persister-local-storage';
Polly.register(FetchAdapter);
Polly.register(LocalStoragePersister);
Cypress.Commands.add('mockVisit', (url, mocks = () => null, options) => {
return cy.visit(
@rhukster
rhukster / sphp.sh
Last active March 30, 2024 10:41
Easy Brew PHP version switching (Now moved to https://github.com/rhukster/sphp.sh)
#!/bin/bash
# Creator: Phil Cook
# Modified: Andy Miller
#
# >>> IMPORTANT: Moved to: https://github.com/rhukster/sphp.sh
# >>> Kept here for legacy purposes
#
osx_major_version=$(sw_vers -productVersion | cut -d. -f1)
osx_minor_version=$(sw_vers -productVersion | cut -d. -f2)
osx_patch_version=$(sw_vers -productVersion | cut -d. -f3)
@Saturate
Saturate / gulp-to-gulp4-codemod.js
Created June 29, 2017 10:01
Convert Gulp 3 to Gulp 4 with a codemod
// Use https://astexplorer.net/
export default function transformer(file, api) {
const j = api.jscodeshift;
const root = j(file.source);
const gulpTaskCalls = root.find(j.CallExpression, {
callee: {
object: {
name: 'gulp'
@gucheen
gucheen / parseLodash.js
Created August 25, 2015 05:51
Safe JSON.parse with lodash.js
function parseLodash(str){
return _.attempt(JSON.parse.bind(null, str));
}
@yoavniran
yoavniran / ultimate-ut-cheat-sheet.md
Last active July 12, 2024 11:15
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai, Sinon, and Jest
@jonathantneal
jonathantneal / README.md
Last active March 19, 2024 23:31
Local SSL websites on macOS Sierra

Local SSL websites on macOS Sierra

These instructions will guide you through the process of setting up local, trusted websites on your own computer.

These instructions are intended to be used on macOS Sierra, but they have been known to work in El Capitan, Yosemite, Mavericks, and Mountain Lion.

NOTE: You may substitute the edit command for nano, vim, or whatever the editor of your choice is. Personally, I forward the edit command to Sublime Text:

alias edit="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"
@samwize
samwize / mocha-guide-to-testing.js
Created February 8, 2014 05:53
Explain Mocha's testing framework - describe(), it() and before()/etc hooks
// # Mocha Guide to Testing
// Objective is to explain describe(), it(), and before()/etc hooks
// 1. `describe()` is merely for grouping, which you can nest as deep
// 2. `it()` is a test case
// 3. `before()`, `beforeEach()`, `after()`, `afterEach()` are hooks to run
// before/after first/each it() or describe().
//
// Which means, `before()` is run before first it()/describe()
@ataliba
ataliba / warning-remote-host
Created April 16, 2012 02:17
Warning: Remote Host Identification Has Changed error and solution
Hello,
this a simple solution for this problem. If you want to access a host with your ssh and receive this error :
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!