Skip to content

Instantly share code, notes, and snippets.

@moyix
moyix / killbutmakeitlooklikeanaccident.sh
Created February 5, 2022 22:51
Script to inject an exit(0) syscall into a running process. NB: only x86_64 for now!
#!/bin/bash
gdb -p "$1" -batch -ex 'set {short}$rip = 0x050f' -ex 'set $rax=231' -ex 'set $rdi=0' -ex 'cont'
@ObjSal
ObjSal / app.js
Last active February 22, 2024 13:29
Posting form data in 3 ways to a Node.js server without third-party libraries - application/json, application/x-www-form-urlencoded, and multipart/form-data
// Author: Salvador Guerrero
'use strict'
const fs = require('fs')
// Project modules
const { CreateServer } = require('./server')
const SecurityUtils = require('./security-utils')
@Toilal
Toilal / api.module.ts
Last active February 21, 2023 10:30
@auth0/angular2-jwt Authorization Service and HttpInterceptor supporting JWT Refresh Token (Angular 4.3+ & 5+)
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { JWT_OPTIONS, JwtInterceptor, JwtModule } from '@auth0/angular-jwt';
import { AuthorizationService } from './authorization.service';
import { environment } from '../../environments/environment';
import { HTTP_INTERCEPTORS, HttpClientModule } from '@angular/common/http';
import { RefreshTokenInterceptor } from './refresh-token-interceptor';
function jwtOptionsFactory (authorizationService: AuthorizationService) {
return {
@andywer
andywer / talk-proposal.md
Last active December 23, 2020 17:22
Reactive Conf 2017 ⚡️ Talk Proposal - Memory Leak Hunt 2017 Style

This is a proposal for lightning talk at Reactive Conf. Please 🌟 this gist to push the proposal!

Memory Leak Testing in 2017

Hi, I am Andy, creator of leakage - the node-powered memory leak testing library.

Instead of manual debugging it provides a structured approach to fix or even prevent memory leaks.

@chl03ks
chl03ks / capitalizefirst.pipe.ts
Created August 11, 2016 15:13
An Angular 2 pipe to capitalize the first letter of a string value.
import { Pipe, PipeTransform } from '@angular/core';
/*
* Capitalize the first letter of the string
* Takes a string as a value.
* Usage:
* value | capitalizefirst
* Example:
* // value.name = daniel
* {{ value.name | capitalizefirst }}
* fromats to: Daniel
@Couto
Couto / webpack.js
Last active November 11, 2020 17:53
Fetch polyfill with webpack
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var path = require('path');
var folders = {
APP: path.resolve(__dirname, '../app'),
BUILD: path.resolve(__dirname, '../build'),
BOWER: path.resolve(__dirname, '../bower_components'),
NPM: path.resolve(__dirname, '../node_modules')
};
@chris-rock
chris-rock / httpie.sh
Created August 3, 2014 14:39
Httpie Quick Install Ubuntu 14.04
apt-get update && apt-get install -y curl && curl --silent https://bootstrap.pypa.io/get-pip.py |python3 && pip install --upgrade httpie
@staltz
staltz / introrx.md
Last active May 3, 2024 13:00
The introduction to Reactive Programming you've been missing
@branneman
branneman / better-nodejs-require-paths.md
Last active April 27, 2024 04:16
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@willurd
willurd / web-servers.md
Last active April 28, 2024 21:38
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000