Skip to content

Instantly share code, notes, and snippets.

@AdnaneX
AdnaneX / postman-pre-request-to-get-token.js
Last active July 4, 2020 00:33 — forked from bcnzer/postman-pre-request.js
Postman pre-request script to automatically get a bearer token from Auth0 and save it for reuse
const echoPostRequest = {
url: pm.environment.get('api_url'),
method: 'POST',
header: 'Content-Type:application/json',
body: {
mode: 'application/json',
raw: JSON.stringify(
{
client_id:pm.environment.get('client_id'),
client_secret:pm.environment.get('client_secret'),
DBNAME=<database_name>
TABLE=<table_name>
FNAME=/path/to/output/dir/$(date +%Y.%m.%d)-$DBNAME.csv
#(1)creates empty file and sets up column names using the information_schema
mysql -u <username> -p<password> $DBNAME -B -e "SELECT COLUMN_NAME FROM information_schema.COLUMNS C WHERE table_name = '$TABLE';" | awk '{print $1}' | grep -iv ^COLUMN_NAME$ | sed 's/^/"/g;s/$/"/g' | tr '\n' ',' > $FNAME
#(2)appends newline to mark beginning of data vs. column titles
echo "" >> $FNAME
@AdnaneX
AdnaneX / DialogLoader.vue
Created October 21, 2019 16:13 — forked from tripflex/DialogLoader.vue
Vuetify Dialog Loader Component (with SnackBar) component that can be used locally or globally ( https://github.com/tripflex/VuetifyDialogLoader )
<template>
<div>
<!-- Using hide-overlay below allows for clicking while progress showing-->
<v-dialog
v-model="dialog"
persistent
:width="options.width"
v-bind:style="{ zIndex: options.zIndex }"
>
<v-card
@AdnaneX
AdnaneX / Confirm.vue
Created October 21, 2019 16:13 — forked from eolant/Confirm.vue
Vuetify Confirm Dialog component that can be used locally or globally
<template>
<v-dialog v-model="dialog" :max-width="options.width" :style="{ zIndex: options.zIndex }" @keydown.esc="cancel">
<v-card>
<v-toolbar dark :color="options.color" dense flat>
<v-toolbar-title class="white--text">{{ title }}</v-toolbar-title>
</v-toolbar>
<v-card-text v-show="!!message" class="pa-4">{{ message }}</v-card-text>
<v-card-actions class="pt-0">
<v-spacer></v-spacer>
<v-btn color="primary darken-1" text @click.native="agree">Yes</v-btn>
@AdnaneX
AdnaneX / nodejs-tcp-example.js
Created February 12, 2019 20:13 — forked from tedmiston/nodejs-tcp-example.js
Node.js TCP client and server example
/*
In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp
server, but for some reason omit a client connecting to it. I added an
example at the bottom.
Save the following server in example.js:
*/
var net = require('net');
#!bin/bash
DOCKER_PIDS=$(docker ps -a -q)
if [ -n "$DOCKER_PIDS" ]; then
docker stop $DOCKER_PIDS && docker rm $DOCKER_PIDS
fi