Skip to content

Instantly share code, notes, and snippets.

@AreebaAroosh
AreebaAroosh / encapsulate.cs
Created December 17, 2022 05:05 — forked from swalex/encapsulate.cs
Encapsulate (save) PDF with FO-DICOM (into a DCM file)
public static void Encapsulate( Patient patient, Study study, Institution institution, string directory, string filename, byte[] pdf )
{
var name = new DicomPersonName( DicomTag.PatientName, patient.LastName, patient.FirstName,
patient.MiddleName, patient.NamePrefix, patient.NameSuffix );
var studyUID = new DicomUID( study.InstanceUID, "Study Instance UID", DicomUidType.SOPInstance );
var company = Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyCompanyAttribute>().Company;
var product = Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyProductAttribute>().Product;
DicomDataset[] refItems = study.Series
.SelectMany( s => s.Datasets )
@AreebaAroosh
AreebaAroosh / DownloadFile.cs
Created April 5, 2019 11:43 — forked from nboubakr/DownloadFile.cs
Simple function in C# to download a file from the internet, supports to resume the download.
public static void downloadFile(string sourceURL, string destinationPath)
{
long fileSize = 0;
int bufferSize = 1024;
bufferSize *= 1000;
long existLen = 0;
System.IO.FileStream saveFileStream;
if (System.IO.File.Exists(destinationPath))
{
@AreebaAroosh
AreebaAroosh / MessageHelper
Created March 14, 2019 18:09 — forked from BoyCook/MessageHelper
C# Helper file for using WM_DATACOPY in Win32 API
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.InteropServices;
using System.Diagnostics;
public class MessageHelper
{
@AreebaAroosh
AreebaAroosh / rxjs-diagrams.md
Created January 3, 2019 08:02 — forked from PCreations/rxjs-diagrams.md
Super Intuitive Interactive Diagrams to learn combining RxJS sequences by Max NgWizard K
@AreebaAroosh
AreebaAroosh / Angular directives
Created December 29, 2018 19:59 — forked from adamreisnz/Angular directives
A collection of random useful Angular directives
Angular directives
@AreebaAroosh
AreebaAroosh / date.extensions.ts
Created December 20, 2018 16:38 — forked from weslleih/date.extensions.ts
Extend the TypeScript Date Object with some useful methods
export {}
declare global {
interface Date {
addDays(days: number, useThis?: boolean): Date;
isToday(): boolean;
clone(): Date;
isAnotherMonth(date: Date): boolean;
isWeekend(): boolean;
isSameDate(date: Date): boolean;
@AreebaAroosh
AreebaAroosh / VideoScreenGrabber.cs
Created September 13, 2018 19:13 — forked from xmedeko/VideoScreenGrabber.cs
WPF-MediaKit video screen grabbing helper.
using System;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Interop;
using WPFMediaKit.DirectShow.Controls;
using WPFMediaKit.DirectShow.MediaPlayers;
namespace Test_Application
{
@AreebaAroosh
AreebaAroosh / SimpleHttpServer.cs
Created June 8, 2018 13:58 — forked from augustoproiete/SimpleHttpServer.cs
C# Based HttpListener Static File Web Server
using System;
using System.Collections.Generic;
using System.Net.Sockets;
using System.Net;
using System.IO;
using System.Threading;
using System.Windows.Forms;
using Westwind.Utilities;
namespace Westwind.WebConnection
@AreebaAroosh
AreebaAroosh / generate-pushid.js
Created November 6, 2017 13:26 — forked from mikelehen/generate-pushid.js
JavaScript code for generating Firebase Push IDs
/**
* Fancy ID generator that creates 20-character string identifiers with the following properties:
*
* 1. They're based on timestamp so that they sort *after* any existing ids.
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs.
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly).
* 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the
* latter ones will sort after the former ones. We do this by using the previous random bits
* but "incrementing" them by 1 (only in the case of a timestamp collision).
*/
@AreebaAroosh
AreebaAroosh / uid.ts
Created November 6, 2017 13:25 — forked from origin1tech/uid.ts
JavaScript Firebase UID Generation
export interface IUID {
generate(): string;
timestamp(uid: string, asDate?: boolean): number | Date;
}
/**
* SEE --> https://gist.github.com/mikelehen/3596a30bd69384624c11
*