Skip to content

Instantly share code, notes, and snippets.

View hmenn's full-sized avatar
🎧
Focusing

Hasan MEN hmenn

🎧
Focusing
View GitHub Profile
@fosterbrereton
fosterbrereton / better_macros_better_flags.cpp
Last active January 31, 2025 21:29
Companion source code for the article "Better Macros, Better Flags."
/*
MIT License
Copyright 2019 Foster T. Brereton
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute,
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@drewmoseley
drewmoseley / yocto-mender-rpi3.sh
Last active June 8, 2022 13:44
Script to build Yocto+Mender for Raspberry Pi 3
#!/bin/bash
#
if [ "$(/bin/ls -1A | wc -l)" -ne "0" ]; then
echo Please run this from an empty directory.
exit 1
fi
BASE=$(pwd -P)
@rpavlik
rpavlik / script.sh
Created March 1, 2018 17:24
Reading 24xx i2c eeprom using rpi or other linux board
# Make sure you have i2c-dev loaded and set up for whatever interface you're using
# This is the right one for the default rpi interface.
cd /sys/class/i2c-adapter/i2c-1/
# Instantiate a new device at runtime
# use the right generic chip name (24cSOMETHING) - don't screw this up! see
# table at https://elixir.bootlin.com/linux/v4.14.18/source/drivers/misc/eeprom/at24.c#L136
# description further up at https://elixir.bootlin.com/linux/v4.14.18/source/drivers/misc/eeprom/at24.c#L30
# and info about what this command actually does at
# https://elixir.bootlin.com/linux/v4.14.18/source/Documentation/i2c/instantiating-devices#L207
echo 24c16 0x50 | sudo tee new_device
@mbinna
mbinna / effective_modern_cmake.md
Last active May 7, 2025 15:38
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

@ibrahimlawal
ibrahimlawal / LC_CTYPE.txt
Created February 27, 2017 07:02 — forked from jampajeen/LC_CTYPE.txt
Centos warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
vi /etc/environment
add these lines...
LANG=en_US.utf-8
LC_ALL=en_US.utf-8
@fraguada
fraguada / gist:42eeba928cf85b8ecc989b74d69d3635
Created September 3, 2016 15:32
OpenCV Raspberry Pi Camera Stream
#from http://www.pyimagesearch.com/2015/03/30/accessing-the-raspberry-pi-camera-with-opencv-and-python/
# import the necessary packages
from picamera.array import PiRGBArray
from picamera import PiCamera
import time
import cv2
# initialize the camera and grab a reference to the raw camera capture
camera = PiCamera()
@fclairamb
fclairamb / rapidjson_gen_json.cpp
Created January 5, 2016 13:04
Write some JSON using a rapidjson library
#ifdef SHELL
g++ -Wall -Werror -g -I../../cclib/rapidjson/include $0 && ./a.out
exit 0
#endif
// Output is:
// {"project":"rapidjson","stars":11}
// {"Name":"XYZ","Rollnumer":2,"array":["hello","world"],"Marks":{"Math":"50","Science":"70","English":"50","Social Science":"70"}}
// {"FromEmail":"[email protected]","FromName":"Sender's name","Subject":"My subject","Recipients":[{"Email":"[email protected]"}],"Text-part":"this is my text"}
@willprice
willprice / README-opencv-3.1-raspberry-pi-installation.md
Last active March 29, 2025 23:13
How to install OpenCV 3.1 on Raspbian Jessie (Lite)

Installing OpenCV 3.1 on Raspbian Jessie

Prerequisites

  • Keep your system up to date:
    • $ sudo apt-get update
    • $ sudo apt-get upgrade
    • $ sudo reboot
  • Make sure you've got an internet connection.
  • Make sure you've got
  • wget
@ryankurte
ryankurte / 12d1:1f1c
Last active June 11, 2018 21:17
Enable Huawei K4203 Cellular Internet dongle on Linux
TargetVendor=0x12d1
TargetProduct=0x1f1c
MessageContent="55534243123456780000000000000011062000000101000100000000000000"
@edfungus
edfungus / pupil.py
Last active February 17, 2025 12:44
Pupil Detection with Python and OpenCV
#Identify pupils. Based on beta 1
import numpy as np
import cv2
import time
cap = cv2.VideoCapture(0) #640,480
w = 640
h = 480