Skip to content

Instantly share code, notes, and snippets.

View coucoseth's full-sized avatar
🏠
Working from home

ochieng seth coucoseth

🏠
Working from home
  • Uganda
  • 08:49 (UTC +03:00)
View GitHub Profile
@coucoseth
coucoseth / rsa.js
Created May 14, 2022 04:22 — forked from sohamkamani/rsa.js
An example of RSA Encryption implemented in Node.js
const crypto = require("crypto")
// The `generateKeyPairSync` method accepts two arguments:
// 1. The type ok keys we want, which in this case is "rsa"
// 2. An object with the properties of the key
const { publicKey, privateKey } = crypto.generateKeyPairSync("rsa", {
// The standard secure default length for RSA keys is 2048 bits
modulusLength: 2048,
})
@coucoseth
coucoseth / google app script file
Created April 20, 2022 07:49
move data from google sheet to mysql database on localhost
function myFunction() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName("MVL"); // MVL is the name of sheet in google sheet doc
// collecting data from 2nd Row , 1st column to last row and last column
var rows = sheet.getRange(2,1,sheet.getLastRow()-1, sheet.getLastColumn()).getValues();
var jo = {};
var dataArray = [];
Logger.log(rows.length)
@coucoseth
coucoseth / subdomain setup
Created December 14, 2021 12:14
add a subdomain to vps
cd /etc/nginx/sites-available then
create a .conf file or just cp the default file or any other api files and edit the ports
cd /etc/nginx/sites-enabled
ln -s /etc/nginx/sites-available/yoursubdomain
sudo certbot --nginx
setting up a none root user on vps
Step 1 - login to putty with root user
Step 2 - sudo adduser <username> then
sudo usermod -aG sudo <username> to give sudo previlages
Step 3 - test user by switching to it
sudo su - <username>
Installing Node/NPM
Step 1 — curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash -
then
sudo apt-get install -y nodejs
@coucoseth
coucoseth / ImageUploadForm.js
Created March 22, 2021 13:27 — forked from singh100ful/ImageUploadForm.js
React Native Image Picker Form Using Formik
import React, {Component} from 'react';
import {Formik} from 'formik';
import ImagePicker from 'react-native-image-picker';
import {
View,
Text,
TouchableOpacity
} from 'react-native';
export deafault class App extends Component {
@coucoseth
coucoseth / node_nginx_ssl.md
Created March 11, 2021 08:20 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user