Skip to content

Instantly share code, notes, and snippets.

Avatar
☑️
‌‌

nic

☑️
‌‌
View GitHub Profile
@nic
nic / git-repo-mirror.md
Created Mar 6, 2019
Mirroring a repo from BitBucket (or Gitlab) to Github
View git-repo-mirror.md
  1. Create an empty repo in Github
  2. git clone --bare git@bitbucket.org:user/repo.git
  3. cd repo.git
  4. git push --mirror git@github.com:user/repo.git
View find_grep.js
#!/usr/bin/env node
const fs = require('fs');
const path = require('path');
const Readable = require('readable-stream').Readable;
function complements(arr, predicate) {
const out = [[],[]];
arr.forEach(e => out[Number(!!predicate(e))].push(e));
return out;
View latency_meter.sh
#!/bin/bash
if [ -z "$1" ]; then
echo -e "Usage:\n $0 address\n\nEx: $0 google.com"
exit 0
fi
for ip in `nslookup $1 |grep Address|grep -v 53 |cut -d":" -f2|cut -d' ' -f2`; do
echo "$ip -> $(ping -c 1 "$ip" | grep time |cut -d'=' -f4)";
done
@nic
nic / setup_relay.js
Last active Dec 15, 2017
create-react-app + Relay Modern without Eject
View setup_relay.js
#!/usr/bin/env node
// by nic - 2017
// It's 10 lines of code to prevent you to call 'yarn eject'
// Just call this script before start/build as in this example: https://github.com/nic/relay/blob/master/package.json#L23-L24
const fs = require('fs'),
file = require('path').resolve('./node_modules/babel-preset-react-app/index.js'),
texts = fs.readFileSync(file, 'utf8'),
plugin = 'babel-plugin-relay',
pattern = 'const plugins = [';
View keybase.md

Keybase proof

I hereby claim:

  • I am nic on github.
  • I am upnic (https://keybase.io/upnic) on keybase.
  • I have a public key ASC5pwdB_-h8PvZaGxDv7HyUMguyoT87JT9tSj98UdkcRgo

To claim this, I am signing this object:

You can’t perform that action at this time.