Skip to content

Instantly share code, notes, and snippets.

View cdimascio's full-sized avatar
👋
🤔👨‍💻🚀

Carmine DiMascio cdimascio

👋
🤔👨‍💻🚀
View GitHub Profile
@Neo23x0
Neo23x0 / log4j_rce_detection.md
Last active January 28, 2024 08:19
Log4j RCE CVE-2021-44228 Exploitation Detection

log4j RCE Exploitation Detection

You can use these commands and rules to search for exploitation attempts against log4j RCE vulnerability CVE-2021-44228

Grep / Zgrep

This command searches for exploitation attempts in uncompressed files in folder /var/log and all sub folders

sudo egrep -I -i -r '\$(\{|%7B)jndi:(ldap[s]?|rmi|dns|nis|iiop|corba|nds|http):/[^\n]+' /var/log
# Execute onto container
aws ecs execute-command \
--region us-west-2 \
--cluster PeprServiceStackDev-EcsDefaultClusterMnL3mNNYNVpc18E0451A-dn35gqXUjrhi \
--task e575d819e2e04dac99387d22a5219576 \
--command /bin/bash --interactive
# Run task with execute enable
aws ecs run-task \
--cluster PeprServiceStackDev-EcsDefaultClusterMnL3mNNYNVpc18E0451A-dn35gqXUjrhi \
@eladchen
eladchen / CustomApolloServer.ts
Created July 10, 2020 07:06
An example of how to access apollo context in formatError() method.
import { Request, Response } from "express";
import { GraphQLError, GraphQLFormattedError } from "graphql";
import { GraphQLServerOptions } from "apollo-server-core/src/graphqlOptions";
import { ApolloServer, ApolloServerExpressConfig as C } from "apollo-server-express";
export type FormatError = (graphQLError: GraphQLError, context: unknown) => GraphQLFormattedError;
export type ApolloServerExpressConfig = Omit<C, "formatError"> & {
formatError?: FormatError;
};
import { DataSource } from 'apollo-datasource'
import { InMemoryLRUCache } from 'apollo-server-caching'
import DataLoader from 'dataloader'
class FooDataSource extends DataSource {
constructor(dbClient) {
super()
this.db = dbClient
this.loader = new DataLoader(ids => dbClient.getByIds(ids))
}
@alecholmez
alecholmez / delta_xds.md
Last active October 12, 2021 17:21
Incremental xDS Implementation Plan
@vemarav
vemarav / console.js
Last active October 22, 2020 03:21
Build rails like console in nodejs
/**
* add console.js at ther root of your app
* Modify to make it more helpful for your project
* > Note: `esm` adds ES6 support in Node
* In package.json
* ...
* "scripts": {
* "start": "nodemon -r esm ./server.js"
* "console": "node -r esm --experimental-repl-await console",
* }
@cdimascio
cdimascio / create_user.sh
Last active April 20, 2018 13:54
Create MongoDB user via Mongo shell
# start the mongo shell, then set to the appropriate db and create a user
# in this case, create a user with dbadmin, and read write access roles
use my_db
db.createUser( { user: "my_user", pwd: "MyP@ssw0rd", roles: [ { role: "readWrite", db: "my_db"}, { role: "dbAdmin", db: "my_db" } ] })

In this tutorial we're going to build a set of parser combinators.

What is a parser combinator?

We'll answer the above question in 2 steps.

  1. What is a parser?
  2. and, what is a parser combinator?

So first question: What is parser?

@jganzabal
jganzabal / Nvidia Titan XP + MacBook Pro + Akitio Node + Tensorflow + Keras.md
Last active November 2, 2022 11:43
How to setup Nvidia Titan XP for deep learning on a MacBook Pro with Akitio Node + Tensorflow + Keras
@jpbarto
jpbarto / secure_iam_get.js
Created May 18, 2017 23:17
NodeJS SigV4 Invocation of AWS IAM authorized API Gateway endpoint
/** The following is a NodeJS port of the AWS SigV4 signing sample code (Python) to NodeJS
* The addition of the Authorization header has been informed by the use of Postman
* For more information see the following documentation:
* http://docs.aws.amazon.com/general/latest/gr/sigv4-signed-request-examples.html
*/
var https = require('https');
var crypto = require('crypto');
function sign(key, message) {