Skip to content

Instantly share code, notes, and snippets.

@risha700
risha700 / opencv_stack_view.md
Last active Apr 21, 2021
Stack images in one window Opencv python
View opencv_stack_view.md

""" params:

  • scale: int 2.2>scale>0
  • img_array: list or tuple of opencv mat img and string label (matImg,"mat-img" )
  • columns: int:optional - acts as manual override to control how many columns you want to display the number of images you sent, defaults to 4 and does some calculations for assumpions.

Usage: cv2.imshow("stacked", stack_images(1.2, (img, "img-label")))

View OPENSSL.MD
  1. Create a private key (as Root CA Key), keep this very private
  2. Self-sign a root certificate
  3. Install root CA on your various workstations
  4. Create a CSR(Certificate Signing Request) for each of your authorized needed circumstances(device, server, client, etc.)
  5. Sign CA with root CA Key
# generate a signing key

View ZENAMART.gs
//This script is provided by Ahmed Shehab<ahbox@outlook.com> under BSD License
//helpers
function flush(){
SpreadsheetApp.flush();
}
function get_cuurent_sheet_name() {
var key = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getName();
return key;
@risha700
risha700 / code.gs
Last active Nov 10, 2019
Google sheet script
View code.gs
//helpers
function flush(){
SpreadsheetApp.flush();
}
function get_cuurent_sheet_name() {
var key = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getName();
return key;
}
function back_to_dashboard(){
View generate_remote_ssh.md
cat ~/.ssh/id_rsa.pub | ssh username@remote_host "mkdir -p ~/.ssh && touch ~/.ssh/authorized_keys && chmod -R go= ~/.ssh && cat >> ~/.ssh/authorized_keys"

sudo systemctl restart ssh
@risha700
risha700 / clean_users.md
Last active Dec 13, 2019
Clean linux users
View clean_users.md

get current ssh active users

usr=`awk -F: '{ print $1}' /etc/passwd`
usr=`getent passwd|grep -v 'root'|awk '/home/'| awk -F: '{ print $1}'`
for user in $(echo $usr); do if [ $user != `whoami` ];then  sudo userdel -r $user; fi; done

kill the stale process

stale=`ps aux |grep ssh |egrep -v 'root'| awk '{print $2}'`
for process in $stale;do sudo pkill -9 $process;done
@risha700
risha700 / ubuntu-config.md
Created Sep 7, 2019
Ubuntu server pre config
View ubuntu-config.md

install packages

sudo apt update
sudo apt install python3-pip python3-dev libpq-dev postgresql postgresql-contrib nginx curl

setup postgres

sudo -u postgres psql
CREATE DATABASE $projectname;
@risha700
risha700 / webpack.config.js_gist.md
Last active Aug 27, 2019
webpack configuration for django
View webpack.config.js_gist.md

webpack with django-bundle-tracker settings

let path = require('path');
let glob = require('glob')
let webpack = require('webpack');
let { CleanWebpackPlugin } = require('clean-webpack-plugin');
let HtmlWebpackPlugin = require('html-webpack-plugin');
let inProduction = process.env.NODE_ENV === 'production'
let PurgecssPlugin = require('purgecss-webpack-plugin')
let MiniCssExtractPlugin = require('mini-css-extract-plugin')
View macaddress.md

get machine address python

pip install netifaces

netifaces.ifaddresses(netifaces.gateways()['default'][netifaces.AF_INET][1])[netifaces.AF_LINK][0]['addr']
View webpack.config.js
let webpack = require('webpack');
let path = require('path');
module.exports = {
entry: {
app: './resources/assets/js/app.js',
vendor: ['vue', 'axios']
},
output: {