Skip to content

Instantly share code, notes, and snippets.

View gpsarkar's full-sized avatar
💭
🚀

Ganapati Sarkar gpsarkar

💭
🚀
View GitHub Profile
@gpsarkar
gpsarkar / gist:a7c593c91668f56c8e493d2eb490adab
Created August 24, 2021 17:58
update all packages in package.json
npx npm-check-updates -u --timeout 120000
npm install
Javascript
-----------------
https://github.com/systemjs/systemjs
SystemJS is a hookable, standards-based module loader. It provides a workflow where code written for production workflows of native ES modules in browsers (like Rollup code-splitting builds), can be transpiled to the System.register module format to work in older browsers that don't support native modules, running almost-native module speeds while supporting top-level await, dynamic import, circular references and live bindings, import.meta.url, module types, import maps, integrity and Content Security Policy with compatibility in older browsers back to IE11.
@gpsarkar
gpsarkar / gist:4525e22f28fe0c01c9af3721265d1327
Created July 11, 2020 20:31
react-native-metro-server-error
Add this script in package.json
"android:linux": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res && react-native run-android",
@gpsarkar
gpsarkar / storybook-enzyme-interation.stories.js
Created May 10, 2020 09:34
storybook enzyme spec interation
import React from 'react';
import MyComponent from '../src/components/MyComponent';
import { shallow, mount, render } from 'enzyme';
import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
configure({ adapter: new Adapter() });
import { specs, describe, it } from 'storybook-addon-specifications'
import expect from "expect";
@gpsarkar
gpsarkar / install.sh
Created March 4, 2020 11:42 — forked from ziadoz/install.sh
Install Chrome, ChromeDriver and Selenium on Ubuntu 16.04
#!/usr/bin/env bash
# https://developers.supportbee.com/blog/setting-up-cucumber-to-run-with-Chrome-on-Linux/
# https://gist.github.com/curtismcmullan/7be1a8c1c841a9d8db2c
# https://stackoverflow.com/questions/10792403/how-do-i-get-chrome-working-with-selenium-using-php-webdriver
# https://stackoverflow.com/questions/26133486/how-to-specify-binary-path-for-remote-chromedriver-in-codeception
# https://stackoverflow.com/questions/40262682/how-to-run-selenium-3-x-with-chrome-driver-through-terminal
# https://askubuntu.com/questions/760085/how-do-you-install-google-chrome-on-ubuntu-16-04
# Versions
CHROME_DRIVER_VERSION=`curl -sS https://chromedriver.storage.googleapis.com/LATEST_RELEASE`
@gpsarkar
gpsarkar / gist:4d8acb20f3f87561bc7b282472cf0b4e
Created February 17, 2020 19:51
Connec to postgres on host from docker
docker run --rm -it -p 5433:5433 --add-host=localhost:192.168.1.2 -p 80:80/tcp myimage:latest
C:\Program Files\PostgreSQL\11\data\pg_hba.conf
host all all 172.17.0.1/16 md5
host all all 192.168.1.2/32 md5
C:\Program Files\PostgreSQL\11\data\postgresql.conf
listen_addresses = '*'
@gpsarkar
gpsarkar / gist:8e352d8de596d2f1e5a34344185602cc
Created February 4, 2020 12:26
Entity framework core migration command
Install nuget package "Microsoft.EntityFrameworkCore.Tools" in infrastructure project.
Run this in nuget console.
add-migration Initial -Context "XYZDbContext" -StartupProject ABC.XYZ.Web -Project ABC.XYZ.Infrastructure
@gpsarkar
gpsarkar / gist:5fdb9c52bca9b05aae9cc19f47c3dd5d
Created November 12, 2019 10:15
get userid and tenant id from access token using JwtSecurityTokenHandler
public static UserInfo GetClaimsFromToken(string accessTokenAsString)
{
var tokenHandler = new JwtSecurityTokenHandler();
if (!(tokenHandler.ReadToken(accessTokenAsString) is JwtSecurityToken accessToken)) return null;
var claims = accessToken.Claims.ToList();
var userId =claims.First(c => c.Type == "id").Value; // These could be different for your case
var tenantId = claims.First(c => c.Type == "tenant_id").Value;
return new UserInfo()
@gpsarkar
gpsarkar / openssl_commands.md
Created July 1, 2019 15:14 — forked from p3t3r67x0/openssl_commands.md
Some list of openssl commands for check and verify your keys

openssl

Install

Install the OpenSSL on Debian based systems

sudo apt-get install openssl
@gpsarkar
gpsarkar / export-pfx-without-password.txt
Created March 4, 2019 14:23
export pfx without password
openssl pkcs12 -in MyCertificate.pfx -clcerts -nokeys -out MyCertificate.crt
openssl pkcs12 -in MyCertificate.pfx -nocerts -out MyCertificate-encrypted.key
openssl rsa -in MyCertificate-encrypted.key -out MyCertificate_unenc.key
openssl pkcs12 -export -out MyCertificate_np.pfx -inkey MyCertificate_unenc.key -in MyCertificate.crt -passout pass: