Skip to content

Instantly share code, notes, and snippets.

View derrickmehaffy's full-sized avatar

DMehaffy derrickmehaffy

View GitHub Profile
@derrickmehaffy
derrickmehaffy / raw SQL queries
Created March 30, 2023 21:57
Performance of updating components
Breakdown of each query performed with a just single component update (repeat component) changing one text field
> http: PUT /content-manager/collection-types/api::test.test/2 (224 ms) 200
- Find admin user who performed the request based on ID
- Find role of admin user
- Get permissions from that role
- Get parent "test" content-type data
- Create join for component data from "test" content-type
- Again get admin user who performed request (why?)
- 3rd time fetching admin user (why?)
const qs = require("qs");
// This is for /topics
// const query = {
// _where: {
// _or: [
// {
// "genericAnswer.lifecycleStatus_in": ["waitingForValidation"],
// },
// {
@derrickmehaffy
derrickmehaffy / server.js
Created August 26, 2021 17:07
Okta config
const OktaOAuth2Strategy = require("passport-okta-oauth20").Strategy;
module.exports = ({ env }) => ({
host: env("HOST", "0.0.0.0"),
port: env.int("PORT", 1337),
// url: env("STRAPI_URL") // This is recommended for production, should be your public URL for Strapi
admin: {
auth: {
secret: env("ADMIN_JWT_SECRET", "7531cd15e67d954d60126ecb4736086a"),
providers: [
@derrickmehaffy
derrickmehaffy / strapi.conf
Created March 20, 2020 14:27
Strapi Nginx Sample Config for SSL
server {
# Listen HTTP
listen 80;
server_name api.example.com;
# Redirect to HTTPS
return 301 https://$host$request_uri;
}
@derrickmehaffy
derrickmehaffy / database.json
Last active May 29, 2020 09:11
Strapi MongoDB URI example
{
"defaultConnection": "default",
"connections": {
"default": {
"connector": "mongoose",
"settings": {
"uri": "mongodb://strapi:[email protected]:27017,strapi-test-shard-00-01-rqvys.gcp.mongodb.net:27017,strapi-test-shard-00-02-rqvys.gcp.mongodb.net:27017/test?ssl=true&replicaSet=strapi-test-shard-0&authSource=admin&retryWrites=true&w=majority"
},
"options": {
"authenticationDatabase": "admin",
@derrickmehaffy
derrickmehaffy / Close - Bug Report
Created October 10, 2019 08:23
DM's Quick Responses
> This is a templated message
Hello, please follow the issue template.
A proper issue submission let's us better understand the origin of your bug and therefore help you.
I will reopen your issue when we receive the issue following the template guidelines and properly fill out the template.
Please update the issue.
@derrickmehaffy
derrickmehaffy / 99-network-tuning.conf
Last active June 11, 2023 03:56
Netdata Suggested Networking tuning for Ubuntu 18.04 systems
# http://www.nateware.com/linux-network-tuning-for-2013.html
# Increase Linux autotuning TCP buffer limits
# Set max to 16MB for 1GE and 32M (33554432) or 54M (56623104) for 10GE
# Don't set tcp_mem itself! Let the kernel scale it based on RAM.
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.core.rmem_default = 16777216
net.core.wmem_default = 16777216
net.core.optmem_max = 40960
@derrickmehaffy
derrickmehaffy / gist:10d7d6598358a3f155ed200b6d2bb466
Created July 15, 2019 15:39
Hacky way to use custom plugins in admin for Strapi beta from soupette
// First make sure your plugin has the following
1 - A pluginId file path my-plugin/admin/src/pluginId.js
```
import pluginPkg from '../../package.json';
const pluginId = pluginPkg.name.replace(/^strapi-plugin-/i, '');
export default pluginId;
```
request
response
app
req
res
originalUrl
state
_i18n
matched
router