Skip to content

Instantly share code, notes, and snippets.

@k-128
k-128 / 00 - Computer Networks.md
Last active March 7, 2023 16:22
Computer Networks
@RDux
RDux / README.md
Last active October 1, 2020 07:47
Basic GridFS operation that illustrates excessive memory usage in the official driver.

Description

Opening a mp4 video from GridFS leads to excessive memory usage after a few concurrent calls. The video in question is 43276570 bytes in size. I mention video because it was the scenario that caused me to notice the problem initially, however I think it's fair to assume the results will be the same regardless of what content you are loading.

It wasn't hard to spot something was going on since I noticed 100MiB+ of memory was being used after opening the video twice in different browser tabs. To get a feel for the gravity of the issue I ran a siege benchmark with 50 concurrent users.

siege -c 50 -r 1 'http://localhost:8080/'
@wallyqs
wallyqs / nats-statefulset.yaml
Last active June 14, 2022 14:52
nats-statefulset.yaml
---
apiVersion: v1
kind: Service
metadata:
name: nats
labels:
app: nats
spec:
selector:
app: nats
@laprasdrum
laprasdrum / iOSJailbreak.md
Last active November 25, 2023 20:25
iOS jailbreak -> layout check via cyrun
@jakangah
jakangah / server.js
Created February 7, 2019 16:40
Implementing custom authorization when using express-graphql
# We accomplish this by passing the req and res objects from the expressjs router to the context option
# After getting the specific role or permission from the query instance we can accomplish route validation
let graphQLSchema = {
......
resolve: async function(root, args, context){
context.role = 'ADMIN'
}
}
@mustafauysal
mustafauysal / docker-compose.yml
Created September 1, 2018 17:45
Graylog docker compose file
version: '2'
services:
# MongoDB: https://hub.docker.com/_/mongo/
mongodb:
image: mongo:3
# Elasticsearch: https://www.elastic.co/guide/en/elasticsearch/reference/5.6/docker.html
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:5.6.3
environment:
- http.host=0.0.0.0
@NikoXu
NikoXu / private_debug_methods.m
Last active July 1, 2022 02:24
Powerful private methods for debugging in Cycript & LLDB
## recursiveDescription
I don't think it necessary to introduce this method again. It prints the hierarchy of an UIView object. Here's how we use it in Cycript:
```objc
cy# [[UIApp keyWindow] recursiveDescription].toString()
`<iConsoleWindow: 0x156b6410; baseClass = UIWindow; frame = (0 0; 320 480); autoresize = W+H; gestureRecognizers = <NSArray: 0x156b6bc0>; layer = <UIWindowLayer: 0x156b6720>>
| <UILayoutContainerView: 0x16258d80; frame = (0 0; 320 480); autoresize = W+H; layer = <CALayer: 0x16258e00>>
| | <UITransitionView: 0x16259610; frame = (0 0; 320 480); clipsToBounds = YES; autoresize = W+H; layer = <CALayer: 0x16259760>>
| | | <UIViewControllerWrapperView: 0x16243bb0; frame = (0 0; 320 480); autoresize = W+H; layer = <CALayer: 0x1625a670>>
@subfuzion
subfuzion / dep.md
Last active July 25, 2024 03:38
Concise guide to golang/dep

Overview

This gist is based on the information available at golang/dep, only slightly more terse and annotated with a few notes and links primarily for my own personal benefit. It's public in case this information is helpful to anyone else as well.

I initially advocated Glide for my team and then, more recently, vndr. I've also taken the approach of exerting direct control over what goes into vendor/ in my Dockerfiles, and also work from isolated GOPATH environments on my system per project to ensure that dependencies are explicitly found under vendor/.

At the end of the day, vendoring (and committing vendor/) is about being in control of your dependencies and being able to achieve reproducible builds. While you can achieve this manually, things that are nice to have in a vendoring tool include:

@huyinghuan
huyinghuan / encrypt_file_pkcs5_pkcs7.go
Created May 31, 2017 07:44
golang encrypt with pkcs5 and pkcs7
package main
import (
"bytes"
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"errors"
"io"
"io/ioutil"
@martinwicke
martinwicke / automobile.ipynb
Last active January 9, 2022 08:14
Estimator demo using Automobile dataset
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.