This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
/** | |
* Usage: | |
* | |
* ./update-env.mjs \ | |
* --KEY=value \ | |
* --KEY2=value \ | |
* --key3="Values with spaces need quotes" \ | |
* --K "The assignment operator after a flag is optional" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ curl --help | |
Usage: curl [options...] <url> | |
--abstract-unix-socket <path> Connect via abstract Unix domain socket | |
--alt-svc <file name> Enable alt-svc with this cache file | |
--anyauth Pick any authentication method | |
-a, --append Append to target file when uploading | |
--basic Use HTTP Basic Authentication | |
--cacert <file> CA certificate to verify peer against | |
--capath <dir> CA directory to verify peer against | |
-E, --cert <certificate[:password]> Client certificate file and password |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function P (cb) { | |
var _nextFn | |
var _catchFn | |
/** | |
* User registers a callback via | |
* the 'then()' instance fn | |
*/ | |
this.then = function (cb) { | |
_nextFn = cb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssh-keygen -t rsa -C "email@work_mail.com" -f "id_rsa_work_user1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function DataLoader (_batchLoadingFn) { | |
this._timer | |
this._keys = [] | |
this._batchLoadingFn = _batchLoadingFn | |
} | |
DataLoader.prototype.load = function(key) { | |
clearTimeout(this._timer) | |
const promisedValue = new Promise ( resolve => this._keys.push({key, resolve}) ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const createIterator = async sql => { | |
const client = await pool.connect() | |
const cursor = client.query(new Cursor(sql)) | |
const batchSize = 100 | |
return (async function getRows(client, cursor, batchSize) { | |
let done = false | |
// Get next rows | |
const rows = await new Promise((resolve, reject) => |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react' | |
import { render } from 'react-dom' | |
import Hello from './Hello' | |
import './style.css' | |
const AppContext = React.createContext('app') | |
const Heading2 = props => ( | |
<AppContext.Consumer> | |
{ context => ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://nickjanetakis.com/blog/docker-tip-70-gain-access-to-the-mobylinux-vm-on-windows-or-macos | |
docker container run --rm -it -v /:/host alpine | |
chroot /host |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://dev.to/maheshkay/read-csv-file-using-node-js-29oc | |
const parse = require('csv-parse') | |
const fs = require('fs') | |
const { createReadStream } = fs | |
module.exports = async FILEPATH => { | |
const contents = [] | |
await new Promise((resolve, reject) => { | |
createReadStream(FILEPATH) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
BASE_PATH=/var/opt/gitlab/gitlab-rails/shared/registry/docker/registry/v2/repositories | |
DRY_RUN=0 | |
KEEP_LAST_IMAGES=10 | |
RUN_GARBAGE_COLLECTOR=0 | |
GITLAB_CTL_COMMAND=`which gitlab-ctl` | |
NewerOlder