Skip to content

Instantly share code, notes, and snippets.

View mdmmn378's full-sized avatar
💭
InDeepSleep

Mamunur Rahaman Mamun mdmmn378

💭
InDeepSleep
View GitHub Profile
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'uxdesign.ui'
#
# Created by: PyQt5 UI code generator 5.6
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Embedding_embedding(nn.Module):
def __init__(self):
super().__init__()
self.linear_1 = nn.Embedding(5,3)
self.linear_2 = nn.Linear(3,2,bias=False)
def forward(self,x):
x = self.linear_1(x)
x = self.linear_2(x)
return x
w1 = embd_emb.linear_1._parameters['weight'].detach().numpy().copy()
w2 = embd_emb.linear_2._parameters['weight'].detach().numpy().copy()
grd = 2*np.dot(loss_tmp_emb,w2)
s = embd_emb.linear_1._parameters['weight'].detach().numpy().copy()
rng = list(x_lin.numpy())
for i in rng:
s[i] = s[i] - grd[i]
print(f'Updated weight after manual backpropagation \n{s}')
@mdmmn378
mdmmn378 / pack_padded.md
Last active April 18, 2020 19:45
describes how packing helps to reduce computational overhead

Loading Modules

import torch
from torch.nn import functional as F
@mdmmn378
mdmmn378 / keychron_linux.md
Created February 17, 2022 22:56 — forked from andrebrait/keychron_linux.md
Keychron keyboards on Linux + Bluetooth fixes

Here is the best setup (I think so :D) for K-series Keychron keyboards on Linux.

Most of these commands have been tested on Ubuntu 20.04 and should also work on most Debian-based distributions. If a command happens not to work for you, take a look in the comment section.

Make Fn + F-keys work

Keychron Keyboards on Linux use the hid_apple driver (even in Windows/Android mode), both in Bluetooth and Wired modes. By default, this driver uses the F-keys as multimedia shortcuts and you have to press Fn + the key to get the usual F1 through F12 keys.

@mdmmn378
mdmmn378 / README.md
Created July 6, 2022 05:18 — forked from kbravh/README.md
Switch audio output devices on Linux

Audio Output Switcher

This script will cycle to the next available audio output device. It can be tied to a hotkey to easily be triggered. This is handy, for example, for swapping between HDMI audio and headphones.

Install

  1. Download the audio-device-switch.sh script and place it in /usr/local/bin.
  2. Make the script executable: sudo chmod 755 /usr/local/bin/audio-device-switch.sh.
  3. Open the Keyboard Shortcuts settings page, add a new shortcut, tell it to execute audio-device-switch.sh, and set up your shortcut!
  4. Install the notify-send library if you want to see a popup notification when the audio device switches: sudo apt install libnotify-bin.

Customizations

@mdmmn378
mdmmn378 / Twelve_Go_Best_Practices.md
Created October 15, 2022 13:10 — forked from pzurek/Twelve_Go_Best_Practices.md
Twelve Go Best Practices
@mdmmn378
mdmmn378 / auth.go
Created November 16, 2022 06:37 — forked from yinhm/auth.go
gin middleware for login via Google OAuth 2.0
// Copyright 2014 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// Logiops (Linux driver) configuration for Logitech MX Master 3.
// Includes gestures, smartshift, DPI.
// Tested on logid v0.2.3 - GNOME 3.38.4 on Zorin OS 16 Pro
// What's working:
// 1. Window snapping using Gesture button (Thumb)
// 2. Forward Back Buttons
// 3. Top button (Ratchet-Free wheel)
// What's not working:
// 1. Thumb scroll (H-scroll)
// 2. Scroll button