Skip to content

Instantly share code, notes, and snippets.

View vikasnkumar's full-sized avatar

Vikas N Kumar vikasnkumar

View GitHub Profile
@vikasnkumar
vikasnkumar / pdfgenerator.js
Created February 4, 2025 17:01
HTML TO PDF via JS
$('#pdf_export_button').click(function(e) {
e.preventDefault();
var rname = "screen.pdf";
try {
//NOTE: layout_main is the name of the DIV that you want to export to PDF.
var element = document.getElementById('layout_main');
var myopt = { filename: rname, image: { type: 'jpeg', quality: 0.9 }, jsPDF: { orientation: 'landscape' } };
html2pdf().set(myopt).from(element).save().then(function() {
console.log("PDF has been generated");
});
@vikasnkumar
vikasnkumar / PegexVariableRule.txt
Created May 12, 2014 04:00
Pegex variable rule request
# let us assume we are parsing a financial binary feed. Each message fits into the following C-like structure
struct Msg {
string Ticker;
string Exchange;
byte Type; #### Type can be says something like Stock/Forex/Future/Option
int Count; #### No of KeyValuePairs
struct KeyValue {
string Key;
union Value {
int i;
@vikasnkumar
vikasnkumar / gist:1273842
Created October 9, 2011 16:05
Hotpatch - a shared library injection strategy on Linux
Introduction to Hotpatch
=========================
Hotpatch is a library that can be used to dynamically load a shared library
(.so) file on Linux from one process into another already running process,
without affecting the execution of the target process. The API is a C API, but
also supported in C++.
The current version is 0.2.
The limitations, directions on how to use, and possible uses of hotpatch will be