Skip to content

Instantly share code, notes, and snippets.

View davehorner's full-sized avatar

David Horner davehorner

View GitHub Profile
@SuperKogito
SuperKogito / CaptureMonitorsRects.cpp
Last active June 20, 2022 11:42
A small snippet displaying how to get the rectangles structures (coordinates) associated with all the connected screens/monitors.
/*********************************************************************
* \file CaptureMonitorsRects.cpp
* \brief capture monitors rectangles handles in a custom structure.
*
* \author SuperKogito
* \date July 2020
*
* @note:
* references and sources:
*
@codesections
codesections / server.rs
Last active March 20, 2022 04:35
Naive static file server in rust
use std::io::prelude::*;
use std::net::TcpListener;
use std::net::TcpStream;
mod app;
fn main() {
let listener = TcpListener::bind("127.0.0.1:7878").unwrap();
for stream in listener.incoming() {
let stream = stream.unwrap();
handle_connection(stream);
@Rich-Harris
Rich-Harris / what-is-svelte.md
Last active March 27, 2024 06:09
The truth about Svelte

I've been deceiving you all. I had you believe that Svelte was a UI framework — unlike React and Vue etc, because it shifts work out of the client and into the compiler, but a framework nonetheless.

But that's not exactly accurate. In my defense, I didn't realise it myself until very recently. But with Svelte 3 around the corner, it's time to come clean about what Svelte really is.

Svelte is a language.

Specifically, Svelte is an attempt to answer a question that many people have asked, and a few have answered: what would it look like if we had a language for describing reactive user interfaces?

A few projects that have answered this question:

@imamdigmi
imamdigmi / video_save.py
Last active March 18, 2022 18:26
TensorFlow object detection with video and save the output using OpenCV
"""
This notebook will demontrate a pre-trained model to recognition plate number in an image.
Make sure to follow the [installation instructions](https://github.com/imamdigmi/plate-number-recognition#setup) before you start.
"""
import numpy as np
import os
import six.moves.urllib as urllib
import sys
import tarfile
import tensorflow as tf
@heiswayi
heiswayi / repo-reset.md
Created February 5, 2017 01:32
GitHub - Delete commits history with git commands

First Method

Deleting the .git folder may cause problems in our git repository. If we want to delete all of our commits history, but keep the code in its current state, try this:

# Check out to a temporary branch:
git checkout --orphan TEMP_BRANCH

# Add all the files:
git add -A
@cswiercz
cswiercz / cached_factory.cpp
Last active June 15, 2022 03:04
Herb Sutter's favorite sub-10 line C++ snippet: Factory w/Cache
/*
Cached Factory
Sometimes you want to make objects with a lifetime managed
by their target owner but you also want to hold reference
to them in a custom cache. The target owner, naturally, will
be given a shared_ptr to the output object. However, we don't
want the lifetime of the output object to be tied to the
internal cache. I.e. if the owner dies then the object should
die even if referenced in the cache.
@DarrenN
DarrenN / get-npm-package-version
Last active July 15, 2024 13:04 — forked from yvele/get-npm-package-version.sh
Extract version from package.json (NPM) using bash / shell
# Version key/value should be on his own line
PACKAGE_VERSION=$(cat package.json \
| grep version \
| head -1 \
| awk -F: '{ print $2 }' \
| sed 's/[",]//g')
echo $PACKAGE_VERSION
@cswiercz
cswiercz / simple.py
Last active May 14, 2023 01:07
A quick demonstration of how to plot multivalued complex functions in Python.
import numpy
import sympy
from mpl_toolkits.mplot3d import Axes3D
import matplotlib
from matplotlib import cm, colors
from matplotlib import pyplot as plt
branching_number = 2
@nanis
nanis / imgxform.pl
Created July 11, 2014 00:22
Fun with image transformations in Perl: American Gothic in the palette of Mona Lisa: Rearrange the pixels
#!/usr/bin/env perl
use 5.020; # just because
use strict;
use warnings;
use Const::Fast;
use GD;
GD::Image->trueColor(1);
from fedora
maintainer Mark Allen <mrallen1@yahoo.com>
run yum -y install perl-Mojolicious
run yum -y cpanminus
run cpanm Games::Dice
run yum install -y git
run git clone https://gist.github.com/mrallen1/44a415c302139af78dde
cmd ["morbo", "44a415c302139af78dde/dice.pl", "&"]
expose 3000