Skip to content

Instantly share code, notes, and snippets.

Yogesh Agrawal saggiyogesh

Block or report user

Report or block saggiyogesh

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@saggiyogesh
saggiyogesh / cleanup.sh
Created Sep 5, 2019 — forked from superseb/cleanup.sh
Cleanup host added as custom to Rancher 2.0
View cleanup.sh
#!/bin/sh
docker rm -f $(docker ps -qa)
docker volume rm $(docker volume ls -q)
cleanupdirs="/var/lib/etcd /etc/kubernetes /etc/cni /opt/cni /var/lib/cni /var/run/calico /opt/rke"
for dir in $cleanupdirs; do
echo "Removing $dir"
rm -rf $dir
done
@saggiyogesh
saggiyogesh / bash.sh
Created Aug 25, 2019
Bash script to increment no in file name
View bash.sh
#!/usr/bin/env bash
set -e
# find existing version of static.zip
cd ios;
name=$(ls | grep static)
echo 'grep name: '$name
@saggiyogesh
saggiyogesh / remove-null.js
Created Sep 7, 2018
Remove null, undefined from doc in mongodb. [Terminal code]
View remove-null.js
function getNullKeysRecursively(doc, keyName, nullKeys) {
for (var item_property in doc) {
// SKIP BASE-CLASS STUFF
if (!doc.hasOwnProperty(item_property)) continue;
// SKIP ID FIELD
if (item_property === '_id') continue;
// FULL KEY NAME (FOR SUB-DOCUMENTS)
var fullKeyName;
if (keyName) fullKeyName = keyName + '.' + item_property;
@saggiyogesh
saggiyogesh / code-push-rn-ios.md
Created Aug 9, 2018
Commands for code push RN IOS
View code-push-rn-ios.md
  • Add an app to code-push code-push app add myiosapp ios react-native

    Copy the Production deployment key. Use this key when asked in terminal after doing react-native link code-push

  • Release a build for ios. code-push release-react myiosapp ios

  • Promote the build to production. code-push promote myiosapp Staging Production

@saggiyogesh
saggiyogesh / parse.js
Last active Apr 25, 2018
Parsing custom objects in JSON.parse in javascript
View parse.js
// This script is executed in mongo shell to replace all occurence of a STRING, with an objectId string
// and then using parse, converting objectId string to actual objectId
db.Dummy.find({}).forEach(function(doc) {
console.log(doc._id);
let newDoc = JSON.stringify(doc).replace('STRING', '5ab23ff3423159ad5d0251c0');
print('newDoc', newDoc);
let jsonDoc = JSON.parse(newDoc, (key, value) => {
if (value === '5ab23ff3423159ad5d0251c0') {
View portainer.sh
docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock --restart always portainer/portainer -H unix:///var/run/docker.sock
@saggiyogesh
saggiyogesh / install.md
Created Jul 5, 2017
3 Steps to install latest node & npm on Ubuntu.
View install.md
  • sudo apt-get install npm
  • sudo npm i -g n
  • sudo n latest
  • node -v
@saggiyogesh
saggiyogesh / install-docker-master.sh
Created Mar 6, 2017 — forked from alexellis/install-docker-master.sh
install docker engine for swarm3k on Ubuntu 16.04. 2 options for installing
View install-docker-master.sh
#!/bin/sh
# option 2: paste this into user-data to automate install via boot script
# NOTE: update --label=owner=YOURNAME below if you want to easily identify yours
# renames the host to have a suffix of alexellisio
export original=$(cat /etc/hostname)
sudo hostname $original-master-alexellisio
echo $original-master-alexellisio | sudo tee /etc/hostname
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
@saggiyogesh
saggiyogesh / customer.js
Last active Oct 15, 2016
Loopback create computed props from other props.
View customer.js
module.exports = function (Customer) {
Customer.getter['fullname'] = function () {
return `this.firstName this.lastName`.trim()
};
};
@saggiyogesh
saggiyogesh / nginxproxy.md
Created Sep 22, 2016 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?
View nginxproxy.md

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

You can’t perform that action at this time.