Skip to content

Instantly share code, notes, and snippets.

@mkchandler
mkchandler / ReadSerialPort.cs
Created December 15, 2012 23:41
Some C# code to read a serial port. Using this as a starting point for an Arduino project.
using System;
using System.IO.Ports;
namespace SerialReader
{
class Program
{
static void Main(string[] args)
{
var reader = new ArduinoSerialReader("COM3");
@gizmaa
gizmaa / Plot_Examples.md
Last active June 11, 2025 03:13
Various Julia plotting examples using PyPlot
@staltz
staltz / introrx.md
Last active October 9, 2025 18:43
The introduction to Reactive Programming you've been missing
@bsweger
bsweger / useful_pandas_snippets.md
Last active October 6, 2025 13:44
Useful Pandas Snippets

Useful Pandas Snippets

A personal diary of DataFrame munging over the years.

Data Types and Conversion

Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)

@non
non / answer.md
Last active February 28, 2025 11:46
answer @nuttycom

What is the appeal of dynamically-typed languages?

Kris Nuttycombe asks:

I genuinely wish I understood the appeal of unityped languages better. Can someone who really knows both well-typed and unityped explain?

I think the terms well-typed and unityped are a bit of question-begging here (you might as well say good-typed versus bad-typed), so instead I will say statically-typed and dynamically-typed.

I'm going to approach this article using Scala to stand-in for static typing and Python for dynamic typing. I feel like I am credibly proficient both languages: I don't currently write a lot of Python, but I still have affection for the language, and have probably written hundreds of thousands of lines of Python code over the years.

@spyesx
spyesx / positive_negative.js
Last active July 24, 2025 20:56
Several methods to get a random positive or negative number
// Math.random() will give you a random decimal number between 0 and 1
// Just check if the number is greater than 0.5
// And apply -1 or 1 depending on the result
Math.random() < 0.5 ? -1 : 1;
// Math.random() will give you a random decimal number between 0 and 1
// Math.rand() of a Math.random() will give you an integer 0 or 1
// Use 0 or 1 as a result of a condition to use -1 or 1
Math.round(Math.random()) ? -1 : 1;
// /!\ NOTE : Can be used for any other values like 9 or 37 ; -2 or 2...
@kristopolous
kristopolous / hn_seach.js
Last active July 24, 2023 04:12
hn job query search
// Usage:
// Copy and paste all of this into a debug console window of the "Who is Hiring?" comment thread
// then use as follows:
//
// query(term | [term, term, ...], term | [term, term, ...], ...)
//
// When arguments are in an array then that means an "or" and when they are seperate that means "and"
//
// Term is of the format:
// ((-)text/RegExp) ( '-' means negation )
==========================
How Software Companies Die
==========================
- Orson Scott Card
The environment that nurtures creative programmers kills management and
marketing types - and vice versa.
Programming is the Great Game. It consumes you, body and soul. When
you're caught up in it, nothing else matters. When you emerge into
@UnaNancyOwen
UnaNancyOwen / CMakeLists.txt
Last active June 12, 2024 00:21
CMakeLists for OpenCV that installed using Vcpkg
cmake_minimum_required( VERSION 3.0 )
set( CMAKE_TOOLCHAIN_FILE "C:/vcpkg/scripts/buildsystems/vcpkg.cmake" )
# Create Project
project( solution )
add_executable( project main.cpp )
# Set OpenCVConfig.cmake Search Directory
set( OpenCV_DIR )
if( NOT CMAKE_CL_64 )