Skip to content

Instantly share code, notes, and snippets.

View NISH1001's full-sized avatar
💭
Staring into the abyss...

Nish NISH1001

💭
Staring into the abyss...
View GitHub Profile
@NISH1001
NISH1001 / oracle.md
Last active July 9, 2021 05:21
oracle

Check If archivelog mode is enabled

select log_mode from v$database;

Enable Archive mode

alter database archivelog;
@NISH1001
NISH1001 / cropper.sh
Last active October 15, 2019 11:26
crop video using ffmpeg
# WIDTH:HEIGHT:Xstart:Ystart
ffmpeg -i output.mp4 -filter:v "crop=700:1170:0:50" cropped.mp4
# cut video
ffmpeg -ss 00:03:00.8 -i test.mp4 -c copy -t 00:00:02.2 output.mp4 -y
# embed subtitle
ffmpeg -i inp.mp4 -vf ass=subtitles.ass out.mp4
@NISH1001
NISH1001 / watermark.sh
Created January 26, 2019 23:45
add watermark to video
# add watermark
ffmpeg -y -i demo.mp4 -i logo.png -filter_complex \
"[1]lut=a=val*0.3[a];[0][a]overlay=5:600" \
-c:v libx264 -an output.mp4
@NISH1001
NISH1001 / TopicModelZoo.md
Created January 24, 2019 07:24 — forked from scapegoat06/TopicModelZoo.md
Topic Model Zoo
@NISH1001
NISH1001 / bash-logger.md
Created January 19, 2019 04:18
log bash history to file

Vanilla Configuration

If you are not using any third party variants of bash like oh-my-bash, put the following command in your .bashrc:

export PROMPT_COMMAND='if [ "$(id -u)" -ne 0 ]; then echo "$(date "+%Y-%m-%d.%H:%M:%S") $(pwd) $(history 1)" >> ~/.logs/bash-history-$(date "+%Y-%m-%d").log; fi'

Close bashrc and open new terminal. Now, your history are saved in the folder ~/.logs according to timestamp.
Example file

/home/paradox/.logs/bash-history-2018-12-15.log
from rasa_nlu.featurizers import Featurizer
import tensorflow_hub as hub
import tensorflow as tf
class UniversalSentenceEncoderFeaturizer(Featurizer):
"""Appends a universal sentence encoding to the message's text_features."""
# URL of the TensorFlow Hub Module
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@NISH1001
NISH1001 / imagenet1000_clsid_to_human.txt
Created January 13, 2019 09:23 — forked from yrevar/imagenet1000_clsidx_to_labels.txt
text: imagenet 1000 class id to human readable labels (Fox, E., & Guestrin, C. (n.d.). Coursera Machine Learning Specialization.)
{0: 'tench, Tinca tinca',
1: 'goldfish, Carassius auratus',
2: 'great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias',
3: 'tiger shark, Galeocerdo cuvieri',
4: 'hammerhead, hammerhead shark',
5: 'electric ray, crampfish, numbfish, torpedo',
6: 'stingray',
7: 'cock',
8: 'hen',
9: 'ostrich, Struthio camelus',
@NISH1001
NISH1001 / keras-activation-visualization-cnn.md
Created January 12, 2019 14:42
visualize activation at different layers in CNN in Keras

First get list of all the layers (after activation).

from keras.models import Model
layer_outputs = [layer.output for layer in model.layers]

Predict image and get corresponding activation in each layer

activation_model = Model(inputs=model.input, outputs=layer_outputs)
@NISH1001
NISH1001 / git-shit.md
Last active December 16, 2019 08:41
Rebase and Merge

Suppose there are 2 branches: master and feature

Squash Commits in Feature

  • git checkout feature
  • git rebase feature -i

This will open editor in interactive mode. DIfferent options like pick and squash are available

Rebase Feature into master without squash

First use rebase command standing in the feature branch.