Skip to content

Instantly share code, notes, and snippets.

@maobui
maobui / multiple-ssh-authkeys.md
Created June 22, 2021 16:45 — forked from otkrsk/multiple-ssh-authkeys.md
Add multiple SSH keys to the authorized_keys file to enable SSH authentication when connecting to a server.

Step 1: Generate first ssh key Type the following command to generate your first public and private key on a local workstation. Next provide the required input or accept the defaults. Please do not change the filename and directory location.

workstation 1 $ ssh-keygen -t rsa

Finally, copy your public key to your remote server using scp

@maobui
maobui / github-sshkey-setup.md
Created June 17, 2021 17:19 — forked from ipai/github-sshkey-setup.md
github-sshkey-setup

Making GitHub Remote Ops (e.g. git push) Work with 2-Fac Authentication

The following method will let you use ssh keypair to push & pull commits without Personal Access Token, as long as you select "use ssh" instead of "use https" when cloning the repo.

1. Use OS X Keychain as Git credential helper

Install Git and the osxkeychain helper and tell Git to use it.

1. Find out if Git and the osxkeychain helper are already installed:
$ git credential-osxkeychain
@maobui
maobui / aws-sns-example.js
Created December 17, 2020 16:31 — forked from tmarshall/aws-sns-example.js
aws-sdk sns example, in Node.js
var AWS = require('aws-sdk');
AWS.config.update({
accessKeyId: '{AWS_KEY}',
secretAccessKey: '{AWS_SECRET}',
region: '{SNS_REGION}'
});
var sns = new AWS.SNS();
@maobui
maobui / aws.sns.js
Created December 17, 2020 16:29 — forked from sriharshaj/aws.sns.js
AWS SNS ( Simple Push Notification ) using Node.js
var AWS = require('aws-sdk');
AWS.config.update({accessKeyId: config.AWSAccessKeyId, secretAccessKey: config.AWSSecretKey,{region: config.AWSRegion}});
var sns = AWS.SNS();
var params ={
Name:"test",
Platform:"GCM",//or APNS (Apple ) or ADM (Amazon)
Attributes:{ // required
@maobui
maobui / publish_to_private_npm_from_ci.md
Created November 15, 2020 03:20 — forked from silentHoo/publish_to_private_npm_from_ci.md
Push and pull into and from your private npm registry via CI pipeline

Publish to private npm registry from your CI pipeline

If you want to publish packages to your private registry, e.g. to jfrog.io/Verdaccio/... you should note some important things:

1) Authenticate on your local machine

To authenticate against the private repository, you've to use the npm cli tool. But first you should get your API access token. That's safer than using your password.

npm adduser --registry https://<registry_url>/<api_path>/ --always-auth
@maobui
maobui / multiple_ssh_setting.md
Created November 7, 2020 15:15 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@maobui
maobui / GoogleSheetJson.md
Created July 28, 2020 08:46 — forked from ronaldsmartin/GoogleSheetJson.md
Google Spreadsheet JSON Queries

SheetAsJSON + Filtering

This is an extension of DJ Adams' excellent SheetAsJSON Google Apps Script, which provides a way to GET a published Google Spreadsheet as a JSON feed. This version allows generic filtering for terms, more specific control over which rows to parse, and correct MIME type for JSONP output.

Minimal Usage

The following parameters are required for the script to work.

https://script.google.com/macros/s/AKfycbzGvKKUIaqsMuCj7-A2YRhR-f7GZjl4kSxSN1YyLkS01_CfiyE/exec?
+ id=<spreadsheet key>
+ sheet=<sheet name on spreadsheet>
@maobui
maobui / SimpleRecyclerView.java
Created June 15, 2020 03:15 — forked from saber-solooki/SimpleRecyclerView.java
Sticky Header RecyclerView
package com.saber.customstickyheader;
import android.graphics.Color;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
@maobui
maobui / adbwificonnect.sh
Created May 1, 2020 14:17 — forked from amanshuraikwar/adbwificonnect.sh
Shell script to connect a USB connected device via adb over WiFi
# Purpose: Shell script to connect a USB connected device via adb over WiFi
#
# Author: Amanshu Raikwar
#
# Assumptions:
# 1. USB debugging is enabled in the Android device
# 2. The Android device is connected to the computer via USB
# 3. The Android device is connected to the same wifi as the computer
# 4. The Android device is accessible through port 5555 over the wifi network
#