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 / sql-server-cdc.md
Last active April 30, 2024 13:24
CDC (change data capture) for Microsoft SQL server

MSSQL CLI

github...

UI

https://dbeaver.io/

sqlcmd -S <ip> -d <dbname> -U <username> -P <password> -I
We can't make this file beautiful and searchable because it's too large.
#AUTHID,text,ext,neu,agr,con,opn
1997_504851.txt,"Well, right now I just woke up from a mid-day nap. It's sort of weird, but ever since I moved to Texas, I have had problems concentrating on things. I remember starting my homework in 10th grade as soon as the clock struck 4 and not stopping until it was done. Of course it was easier, but I still did it. But when I moved here, the homework got a little more challenging and there was a lot more busy work, and so I decided not to spend hours doing it, and just getting by. But the thing was that I always paid attention in class and just plain out knew the stuff, and now that I look back, if I had really worked hard and stayed on track the last two years without getting lazy, I would have been a genius, but hey, that's all good. It's too late to correct the past, but I don't really know how to stay focused n the future. The one thing I know is that when people say that b/c they live on campus they can't concentrate, it's b. s. For me it would be easier there, b
@NISH1001
NISH1001 / ffmpeg-audio-gif.sh
Last active March 6, 2024 18:44
merge audio with a looped GIF using ffmpeg
#!/bin/bash
echo "i am paradox"
#ffmpeg -i audio.mp3 -ignore_loop 0 -i test.gif -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" -shortest -strict -2 -c:v libx264 -threads 5 -c:a aac -b:a 192k -pix_fmt yuv420p -shortest final.mp4
# ffmpeg -i audio.mp3 -ignore_loop 0 -i test.gif -shortest -strict -2 -c:v libx264 -threads 5 -c:a aac -b:a 192k -pix_fmt yuv420p -shortest final.mp4
# ffmpeg -i audio.mp3 -ignore_loop 0 -i test.gif -vf "scale=trunc(iw/2)*1:trunc(ih/2)*2" -shortest -strict -2 -c:v libx264 -threads 5 -c:a aac -b:a 192k -pix_fmt yuv420p -shortest final.mp4
@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)
[('ENSMUSG00000117786', 0.19900803),
('ENSMUSG00000093954', 0.13898243),
('ENSMUSG00000028487', 0.13298473),
('ENSMUSG00000113575', 0.08847962),
('ENSMUSG00000056999', 0.043881908),
('ENSMUSG00000117465', 0.03738362),
('ENSMUSG00000067149', 0.03303743),
('ENSMUSG00000090352', 0.027412206),
('ENSMUSG00000094320', 0.020604169),
('ENSMUSG00000090015', 0.018502489),
[[{'condition': {'labels': ['condition_FLT', 'condition_GC'],
'train_score': 1.0,
'test_score': 1.0,
'confusion_matrix': array([[696, 0],
[ 0, 671]]),
'classification_report': {'condition_FLT': {'precision': 1.0,
'recall': 1.0,
'f1-score': 1.0,
'support': 696},
'condition_GC': {'precision': 1.0,
@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
@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 / plates.py
Created May 24, 2020 13:29
Process plate images for stopmotion video
#!/usr/bin/env python3
from tqdm import tqdm
import glob
import os
import sys
import cv2
import matplotlib.pyplot as plt
import numpy as np
#!/usr/bin/env python3
def fib(n):
res = [1,1]
for i in range(n):
res.append(sum(res[-2:]))
return res