Skip to content

Instantly share code, notes, and snippets.

View JaDogg's full-sized avatar
🐢
I may be slow to respond.

JaDoggx86 JaDogg

🐢
I may be slow to respond.
View GitHub Profile
@JaDogg
JaDogg / pesubsys.c
Created March 27, 2024 19:48 — forked from jeremyd2019/pesubsys.c
program to get and set subsystem in PE headers
#include <windows.h>
#include <stddef.h>
#include <stdio.h>
int main(int argc, char ** argv)
{
FILE * fh;
IMAGE_DOS_HEADER idh = {0};
DWORD signature = 0;
long subsys_offset = 0;

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@JaDogg
JaDogg / latency.markdown
Created January 21, 2020 18:24 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@JaDogg
JaDogg / sound_play_crossplatform.py
Created June 21, 2019 21:54 — forked from juancarlospaco/sound_play_crossplatform.py
Cross-platform Sound Playing with Standard Libs only, No Sound file is required, No install is required, Python2 / Python3.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os, sys
from tempfile import gettempdir
from subprocess import call
def beep(waveform=(79, 45, 32, 50, 99, 113, 126, 127)):
abandoned
able
absolute
adorable
adventurous
academic
acceptable
acclaimed
accomplished
accurate
import javafx.application.Application;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.event.*;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.effect.BoxBlur;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.*;
import javafx.scene.image.Image;
import javax.imageio.ImageIO;
import java.awt.image.*;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
public Image getJavaFXImage(byte[] rawPixels, int width, int height) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
ImageIO.write((RenderedImage) createBufferedImage(rawPixels, width, height), "png", out);
@JaDogg
JaDogg / HTMLEditorCustomizationSample.java
Last active October 2, 2020 17:20 — forked from jewelsea/HTMLEditorCustomizationSample.java
Insert An Image On Caret Position JavaFX:HTMLEditor
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ToolBar;
import javafx.scene.web.HTMLEditor;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
@JaDogg
JaDogg / HTMLEditorCustomizationSample.java
Last active August 29, 2015 14:03 — forked from jewelsea/HTMLEditorCustomizationSample.java
Sample Showing how to add an image to HTMLEditor
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ToolBar;
import javafx.scene.web.HTMLEditor;
import javafx.stage.Stage;