Skip to content

Instantly share code, notes, and snippets.

View csemrm's full-sized avatar

Mostafizur Rahman csemrm

View GitHub Profile
@csemrm
csemrm / create_a_virtual_environment_with_conda.md
Created March 18, 2023 20:04 — forked from loic-nazaries/create_a_virtual_environment_with_conda.md
Markdown file to help create a virtual environment in Python with Conda.

Create a Virtual Environment in Python with Conda

The present gist is a hybrid between a 'go-to' cheat sheet and a tutorial when starting a new Data Science Project.

Its purpose is to create a virtual environment for Python with the package manager Conda.


Table of contents

#This is just a listing of the commands for generating your SSL certificates
#Run these commands one at a time from inside your ~/ssl folder
#Make sure you create your server.csr.cnf and your v3.ext files first inside the same folder
#private key generation
#This will ask you for a passphrase(password) do NOT lose this file or the password
openssl genrsa -des3 -out ~/ssl/rootCA.key 2048
#create root certificate
openssl req -x509 -new -nodes -key ~/ssl/rootCA.key -sha256 -days 1024 -out ~/ssl/rootCA.pem
@csemrm
csemrm / self-signed-ssl-mongo.sh
Created October 25, 2021 15:20 — forked from mostafizpantheon/self-signed-ssl-mongo.sh
Self-signed SSL Certificate with OpenSSL on MacOS | MongoDB
openssl genrsa -out CAroot.key 2048
openssl req -new -key CAroot.key -out CAroot.csr # CN should be different from the certificates below
openssl req -x509 -days 1825 -key CAroot.key -in CAroot.csr -out CAroot.crt
cat CAroot.crt CAroot.key > CAroot.pem
openssl genrsa -out mongod.key 2048
openssl req -new -key mongod.key -out mongod.csr
openssl x509 -req -days 1825 -in mongod.csr -CA CAroot.pem -CAkey CAroot.key -CAcreateserial -out mongod.crt
cat mongod.crt mongod.key > mongod.pem
@csemrm
csemrm / settings.php
Last active April 20, 2019 11:33
From bare domain to www for D8
<?php
########
if (isset($_ENV['PANTHEON_ENVIRONMENT']) && php_sapi_name() != 'cli') {
// Redirect to https://$primary_domain in the Live environment
if ($_ENV['PANTHEON_ENVIRONMENT'] === 'live' && ($_SERVER['HTTP_HOST'] !== 'live-psea.pantheonsite.io')) {
if ($is_www = strpos($_SERVER['HTTP_HOST'], 'www')) {
$primary_domain = $_SERVER['HTTP_HOST'];
} else
@csemrm
csemrm / P12toPEM.txt
Created August 29, 2018 11:03 — forked from shahdhiren/P12toPEM.txt
Convert P12 file for Push Notification to PEM format
Development Phase:
Step 1: Create Certificate .pem from Certificate .p12
Command: openssl pkcs12 -clcerts -nokeys -out apns-dev-cert.pem -in apns-dev-cert.p12
Step 2: Create Key .pem from Key .p12
Command : openssl pkcs12 -nocerts -out apns-dev-key.pem -in apns-dev-key.p12
Step 3: Optional (If you want to remove pass phrase asked in second step)
Command : openssl rsa -in apns-dev-key.pem -out apns-dev-key-noenc.pem
@csemrm
csemrm / Readme.md
Created July 27, 2018 10:55 — forked from grantges/Readme.md
Shapes With Appcelerator Titanium and Hyperloop

Custom Alloy Tags based on Appcelerator Hyperloop modules

With Alloy and Hyperloop, you can quickly and easily expose native UI as Custom Alloy tags by leveraging the namespace (ns) attribute and commonjs modules.

Alloy allows you to create your own UI element that can be included into the XML View heirarchy in one of two ways, an Alloy Widget or through the use of Custom Tags.

To create your own custom tag, you link the tag to the commonjs module with the namespace attribute (ns). Here is an example using a custom tag to render a standard Titanium View:

@csemrm
csemrm / Gruntfile.js
Created March 14, 2018 18:15 — forked from FokkeZB/Gruntfile.js
Example Gruntfile.js for The Ultimate Titanium CLI Toolchain at Connect.js
module.exports = function(grunt) {
grunt.initConfig({
settings: {
releaseNotes: grunt.option('notes') || 'CI build',
appName: 'Flashlight',
ppUuid: '0253600x-ac6d-35b6-b66d-dd25c4fd956f',
installrAppToken: '6xC0I8SdJA76kW3pqq7GFZLIyq6fBP4Z'
},
@csemrm
csemrm / app.js
Last active February 18, 2018 11:38
MediaPlayer Hyperloop Android remote URL
var AudioManager = require("android.media.AudioManager"),
MediaPlayer = require('android.media.MediaPlayer');
var audioPlayer = new MediaPlayer();
//mPlayer.prepare();
//audioPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
if (audioPlayer.isPlaying()) {
audioPlayer.reset();
}
audioPlayer.setDataSource('http://revelbeats.com/assets/audio/Salsa/DJ_Johnny_Famolari_Jailmix_salsa.mp3');
var FBSDKShareLinkContent = require("FBSDKShareKit/FBSDKShareLinkContent"),
FBSDKShareDialog = require("FBSDKShareKit/FBSDKShareDialog"),
NSURL = require("Foundation/NSURL");
var win = Ti.UI.createWindow({
backgroundColor: "#fff"
});
var btn = Ti.UI.createButton({
title: "Trigger Share Dialog"
@csemrm
csemrm / titanium-auth-session.js
Created February 13, 2018 20:07 — forked from hansemannn/titanium-auth-session.js
Use Axway Hyperloop to perform OAuth-sessions with the iOS 11+ API "SFAuthenticationSession"
const SFAuthenticationSession = require('SafariServices/SFAuthenticationSession');
const NSURL = require('Foundation/NSURL');
const session = SFAuthenticationSession.alloc().initWithURLCallbackURLSchemeCompletionHandler(
NSURL.alloc().initWithString('https://github.com/login/oauth/authorize?scope=repo&client_id=XXXXX'),
'appcgithub://',
function(url, error) {
if (error != null) {
Ti.API.error('Error performing OAuth: ' + error.localizedDescription);
cb({ success: false, error: 'Error performing OAuth: ' + error.localizedDescription });