Skip to content

Instantly share code, notes, and snippets.

let webpack = require('webpack');
let path = require('path');
module.exports = {
entry: {
app: './resources/assets/js/app.js',
vendor: ['vue', 'axios']
},
output: {

get machine address python

pip install netifaces

netifaces.ifaddresses(netifaces.gateways()['default'][netifaces.AF_INET][1])[netifaces.AF_LINK][0]['addr']
@risha700
risha700 / webpack.config.js_gist.md
Last active August 27, 2019 22:49
webpack configuration for django

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')
@risha700
risha700 / ubuntu-config.md
Created September 7, 2019 23:27
Ubuntu server pre config

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 / clean_users.md
Last active December 13, 2019 19:57
Clean linux users

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
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 / code.gs
Last active November 10, 2019 18:37
Google sheet script
//helpers
function flush(){
SpreadsheetApp.flush();
}
function get_cuurent_sheet_name() {
var key = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getName();
return key;
}
function back_to_dashboard(){
//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 / OPENSSL.MD
Last active July 18, 2021 21:34
Generate localhost SSL
  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

@risha700
risha700 / opencv_stack_view.md
Last active April 21, 2021 20:24
Stack images in one window Opencv python

""" 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")))