Skip to content

Instantly share code, notes, and snippets.

View ganindu7's full-sized avatar

Ganindu Nanayakkara ganindu7

View GitHub Profile
@ganindu7
ganindu7 / gdbinit
Created February 14, 2019 15:59 — forked from chrislongo/gdbinit
.gdbinit - A user-friendly gdb configuration file
# INSTALL INSTRUCTIONS: save as ~/.gdbinit
#
# DESCRIPTION: A user-friendly gdb configuration file.
#
# REVISION : 7.3 (16/04/2010)
#
# CONTRIBUTORS: mammon_, elaine, pusillus, mong, zhang le, l0kit,
# truthix the cyberpunk, fG!, gln
#
# FEEDBACK: https://www.reverse-engineering.net
@ganindu7
ganindu7 / tserv
Created March 3, 2020 16:20 — forked from jiffyclub/tserv
Start a Tornado static file server in a given directory. To start the server in the current directory: `tserv .`. Then go to `http://localhost:8000` to browse the directory.
#!/usr/bin/env python
"""
Starts a Tornado static file server in a given directory.
To start the server in the current directory:
tserv .
Then go to http://localhost:8000 to browse the directory.
Use the --prefix option to add a prefix to the served URL,
@ganindu7
ganindu7 / crc16_comparison.c
Last active April 9, 2021 20:50
Understanding CRC16
//function 1
uint16_t crc16(uint8_t const *data, size_t size)
{
/**
* Author: Mark Alder
* stackoverflow.com/users/1180620/mark-adler
*/
uint16_t crc = 0xFFFF; // I also tried with 0x0000 too - Ganindu
while (size--)
@ganindu7
ganindu7 / udp_gist.py
Created April 20, 2021 16:41
async UDP client on python 3.6.9
import socket
import json
import asyncore
UDP_IP = '127.0.0.1'
UDP_PORT = 2000
class AsyncUDPClient(asyncore.dispatcher):
def __init__(self, host, port):

Editing remote files in Vim with SSH

  1. Configure SSH

    In ~/.ssh/config, include the lines:

    Host *
    ControlPath ~/.ssh/sockets/%r@%h-%p
    
@ganindu7
ganindu7 / debug_information
Last active June 18, 2021 15:22
output of vim --version
-- Resolve completions: Up front
-- Client logfile: /tmp/ycm_b1medad0.log
-- Server Python interpreter: /home/nvidia/.pyenv/versions/3.6.9/bin/python
-- Server Python version: 3.6.9
-- Server has Clang support compiled in: False
-- Clang version: None
-- Extra configuration file found but not loaded
-- Extra configuration path: /home/nvidia/Workspace/development/test_stability/.ycm_extra_conf.py
-- Server running at: http://127.0.0.1:40259
-- Server process ID: 12483
@ganindu7
ganindu7 / deepstream_nvdsanalytics_test.cpp
Last active August 28, 2021 20:39
deepstream_nvdsanalytics_test.cpp
/*
* Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
# Note: try with base
FROM nvcr.io/nvidia/deepstream:6.0-devel
WORKDIR /
ARG buildno
ARG gitcommithash
RUN echo " build number: ${buildno} "
RUN echo "based on commit: ${gitcommithash}"
import os
import pandas as pd
from torchvision.io import read_image
from torch.utils.data import Dataset
class CustomImageDataset(Dataset):
def __init__(self, annotation_file, img_dir, transform=None, target_transform=None):
self.img_labels = pd.read_csv(annotation_file)
self.img_dir = img_dir
self.transform = transform
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.