Skip to content

Instantly share code, notes, and snippets.

@MartyMacGyver
MartyMacGyver / RPi_Kernel_building_cross_compiled.sh
Last active May 12, 2021 06:45
Building the kernel for the Raspberry Pi/Pi2/Pi3 using a cross-compiler
###############################################################################
###############################################################################
###############################################################################
###############################################################################
###############################################################################
###############################################################################
###############################################################################
###############################################################################
###############################################################################
###############################################################################
@taeguk
taeguk / lock.cpp
Last active March 26, 2024 08:41
Lock/Unlock Session by the "computer using rule" in Windows.
/*
Lock/Unlock Session by the "computer using rule".
Support versions >= Windows 7
https://gist.github.com/taeguk/13b607f42020981f6cf9
*/
#include <windows.h>
#include <stdio.h>
#include <time.h>
#include <Wtsapi32.h>
#include "stdafx.h"
#include <stdio.h>
#include <string.h>
#include <windows.h>
#include <Setupapi.h>
#include <devguid.h>
#include "conio.h"
#include "tchar.h"
// Get-WMIObject Win32_pnpentity | ? Description -like "*CH*"
@wassname
wassname / torch_summarize_with_df.py
Last active May 22, 2020 06:09
summarize a torch model like in keras, showing parameters and output shape
# summarize model
from collections import OrderedDict
import pandas as pd
import torch
from torch import nn
from torch.autograd import Variable
class TorchSummarizeDf(object):
def __init__(self, model, weights=False, input_shape=True, nb_trainable=False, debug=False):
@Nikhil-Kasukurthi
Nikhil-Kasukurthi / visualisation.py
Last active December 13, 2022 16:55
Visualisation of CNN using Grad-Cam on PyTorch
import cv2
import numpy as np
import torch
from torchvision import models, transforms
from torch.autograd import Variable
import torch
import torch.nn as nn
import pickle
import os
import argparse
@sol-prog
sol-prog / RPi-GCC-cross-compiler.md
Last active February 14, 2024 22:07
How to build a cross compiler for Raspberry Pi

Sources:

http://preshing.com/20141119/how-to-build-a-gcc-cross-compiler/
https://www.raspberrypi.org/documentation/linux/kernel/building.md


https://wiki.osdev.org/Why_do_I_need_a_Cross_Compiler%3F
https://wiki.osdev.org/GCC_Cross-Compiler
https://wiki.osdev.org/Building_GCC
@andrewjong
andrewjong / pytorch_image_folder_with_file_paths.py
Last active February 27, 2024 09:24
PyTorch Image File Paths With Dataset Dataloader
import torch
from torchvision import datasets
class ImageFolderWithPaths(datasets.ImageFolder):
"""Custom dataset that includes image file paths. Extends
torchvision.datasets.ImageFolder
"""
# override the __getitem__ method. this is the method that dataloader calls
def __getitem__(self, index):
@willprice
willprice / README.md
Last active February 8, 2023 21:27
Install OpenCV 4.1.2 for Raspberry Pi 3 or 4 (Raspbian Buster)

Install OpenCV 4.1.2 on Raspbian Buster

$ chmod +x *.sh
$ ./download-opencv.sh
$ ./install-deps.sh
$ ./build-opencv.sh
$ cd ~/opencv/opencv-4.1.2/build
$ sudo make install
from __future__ import print_function, division
import torch
from torch.autograd import Variable
from sklearn.metrics import accuracy_score
from sklearn.metrics import confusion_matrix
import torch
import torch.nn as nn
import torch.optim as optim
from torch.optim import lr_scheduler
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.