Skip to content

Instantly share code, notes, and snippets.

View sailfish009's full-sized avatar

sailfish009

  • freelancer
  • South Korea
View GitHub Profile
@abcdabcd987
abcdabcd987 / c2nasm.bash
Last active December 11, 2019 22:04
C to NASM Assembly
#!/bin/bash
# thanks to http://stackoverflow.com/a/20743090
# thanks to https://github.com/diogovk/c2nasm
# install objconv: https://github.com/vertis/objconv
#
# $1: source code
set -e
C_FILE="$1"
BASE_NAME="${C_FILE%.*}"
@AlexMAS
AlexMAS / ProcessAsyncHelper.cs
Last active August 30, 2025 20:40
The right way to run external process in .NET (async version)
using System;
using System.Diagnostics;
using System.Text;
using System.Threading.Tasks;
public static class ProcessAsyncHelper
{
public static async Task<ProcessResult> ExecuteShellCommand(string command, string arguments, int timeout)
{
var result = new ProcessResult();
@safijari
safijari / depth_image_filter_ros.py
Created August 2, 2016 17:20
The code I used to apply a median filter to the Intel R200 camera's depth image coming from ROS. Note that you will need to remap topics and that once the filtering is done, you will need to pass it through a depth_image_proc/point_cloud_xyz node to get a point cloud (more info here http://wiki.ros.org/depth_image_proc#depth_image_proc.2BAC8-poi…
#!/usr/bin/env python
"""
Purpose of the file: subscribe to a topic called /image_raw of type sensor_msgs/Image
Apply filter to the resulting image
"""
from __future__ import print_function
import cv2
import numpy as np
import rospy
from sensor_msgs.msg import Image
/* SPI Master Demo written by Robert Mollik, 2016
*
* This demo uses the SPI protocol on a Arduino Uno R3 / ATmega8 controller
*
* The demo sends out a request ID depending, whether a temperature or humidity signal shall be obtained from the slave. Both signals
* are datatype float, however get received as 4 bytes and need to be re-assembled.
*/
#define CS PC0 // Chip select pin, any vacant portpin can be used
/* USI SPI Slave Demo written by Robert Mollik, 2016
*
* This demo uses the SPI protocol with USI interface. This is necessary with with the smaller AVR controller since they don't
* a complete SPI functionality.
* Demo is written for the pinout of an Arduino Trinket and ATtiny85. Pins need to be modified if a different controller is used.
*
* The demo takes receives a request ID from the Master at the beginning of every communication. According to the request ID,
* it sends back either a temperature or a humidity values. Since both values are present in float, the 4 bytes of the float need
* to be send separately.
*/
# Make sure you grab the latest version
curl -OL https://github.com/google/protobuf/releases/download/v3.2.0/protoc-3.2.0-linux-x86_64.zip
# Unzip
unzip protoc-3.2.0-linux-x86_64.zip -d protoc3
# Move protoc to /usr/local/bin/
sudo mv protoc3/bin/* /usr/local/bin/
# Move protoc3/include to /usr/local/include/
@zeux
zeux / deferreddevice.h
Created February 12, 2016 08:33
Implementing Direct3D for fun and profit
struct DeferredDirect3DDevice9: DummyDirect3DDevice9
{
private:
char* begin;
char* write;
char* read;
char* end;
enum command_t
{
@sergnechaev
sergnechaev / sdl2_opengl.cpp
Last active September 26, 2022 02:34 — forked from exavolt/sdl2_opengl.c
Very basic SDL2 OpenGL application (C++1y)
#include <iostream>
#define _USE_MATH_DEFINES
#include <cmath>
#include <SDL2/SDL.h>
#include <SDL2/SDL_opengl.h>
constexpr int SCREEN_WIDTH = 800;
constexpr int SCREEN_HEIGHT = 600;
diff --git a/src/unix/internal.h b/src/unix/internal.h
index 03a9226..b2f1a41 100644
--- a/src/unix/internal.h
+++ b/src/unix/internal.h
@@ -86,7 +86,7 @@
#endif
#if defined(__linux__)
-# define UV__POLLIN UV__EPOLLIN
+# define UV__POLLIN (UV__EPOLLIN | UV__EPOLLPRI)

Rich Hickey on becoming a better developer

Rich Hickey • 3 years ago

Sorry, I have to disagree with the entire premise here.

A wide variety of experiences might lead to well-roundedness, but not to greatness, nor even goodness. By constantly switching from one thing to another you are always reaching above your comfort zone, yes, but doing so by resetting your skill and knowledge level to zero.

Mastery comes from a combination of at least several of the following: