Skip to content

Instantly share code, notes, and snippets.

View djshaji's full-sized avatar
🏠
Working from home

Shaji djshaji

🏠
Working from home
View GitHub Profile
@djshaji
djshaji / DynamicCompressorNode.js
Last active February 13, 2024 07:52
Automatically add dynamic compressor to all video elements on page
compressor = null
videos = document.getElementsByTagName ("video")
for (audioElt of videos) {
audioCtx = new AudioContext();
// Create a MediaElementAudioSourceNode
// Feed the HTMLMediaElement into it
const source = new MediaElementAudioSourceNode(audioCtx, {
mediaElement: audioElt,
@djshaji
djshaji / video.py
Created August 11, 2023 14:59
Generate thumbnail from video
#!/usr/bin/python
# pip install ffmpeg-python
# puts a thumnail in .thumb folder
import ffmpeg
def thumbnail (filename, thumb):
time = 0
width = 640
try:
probe = ffmpeg.probe(filename)
@djshaji
djshaji / enrolment parser.js
Last active May 22, 2023 05:57
parse jucc examination form
list = {}
for (table of document.getElementsByTagName ("table")) {
name = null
email = null
phone = null
reg = null
rollno = null
subjects = null
father = null
list = {}
for (table of document.getElementsByTagName ("table")) {
name = null
reg = null
rollno = null
subjects = null
for (tr of table.getElementsByTagName ("tr")) {
for (td of tr.getElementsByTagName ("td")) {
if (td.width == "44%") reg = td.innerText
// copy and paste in devtools snippets and run on the registration return list page.
rolls = []
regs = []
names = []
data = {}
subjects = []
photos = []
for (i of document.querySelectorAll ("tr")) {
for ( c of i.children) {
@djshaji
djshaji / styles.json
Created February 21, 2023 05:32
Android styles in JSON based on Material Colors for parsing https://gist.github.com/djshaji/87963e7962fb1ad6ad40bc53d5cddd09
{
"Red.Pink": [
"#D32F2F",
"#C2185B"
],
"Red.Purple": [
"#D32F2F",
"#7B1FA2"
],
"Red.DeepPurple": [
@djshaji
djshaji / styles.xml
Created February 21, 2023 05:29
Bunch of Android xml styles based on material colors
<resources><style name="Red.Pink" parent="Theme.AmpRack">
<item name="colorPrimary">#D32F2F</item>
<item name="colorSecondary">#C2185B</item>
</style><style name="Red.Purple" parent="Theme.AmpRack">
<item name="colorPrimary">#D32F2F</item>
<item name="colorSecondary">#7B1FA2</item>
</style><style name="Red.DeepPurple" parent="Theme.AmpRack">
<item name="colorPrimary">#D32F2F</item>
<item name="colorSecondary">#512DA8</item>
</style><style name="Red.Indigo" parent="Theme.AmpRack">
@djshaji
djshaji / material_colors.json
Created February 21, 2023 04:30
Material Design Colors JSON
{
"Red 50": "#FFEBEE",
"Red 100": "#FFCDD2",
"Red 200": "#EF9A9A",
"Red 300": "#E57373",
"Red 400": "#EF5350",
"Red 500": "#F44336",
"Red 600": "#E53935",
"Red 700": "#D32F2F",
"Red 800": "#C62828",