Skip to content

Instantly share code, notes, and snippets.

View sailfish009's full-sized avatar

sailfish009

  • freelancer
  • South Korea
View GitHub Profile
@sailfish009
sailfish009 / richhickey.md
Created April 18, 2018 03:25 — forked from prakhar1989/richhickey.md
richhickey.md

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:

@sailfish009
sailfish009 / c2nasm.bash
Created March 21, 2019 05:47 — forked from abcdabcd987/c2nasm.bash
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%.*}"
@sailfish009
sailfish009 / ctz_clz.cpp
Created April 20, 2019 08:22 — forked from pps83/ctz_clz.cpp
__builtin_ctz (ctzl, ctzll) and __builtin_clz (clzl, clzll) for Visual Studio
#ifdef _MSC_VER
#include <intrin.h>
static inline int __builtin_ctz(uint32_t x) {
unsigned long ret;
_BitScanForward(&ret, x);
return (int)ret;
}
static inline int __builtin_ctzll(unsigned long long x) {
@sailfish009
sailfish009 / binary_gcd.cpp
Created April 21, 2019 05:44 — forked from cslarsen/binary_gcd.cpp
Binary gcd algorithm in C++ using iteration and bit shifts
/*
* The binary gcd algorithm using iteration.
* Should be fairly fast.
*
* Put in the public domain by the author:
*
* Christian Stigen Larsen
* http://csl.sublevel3.org
*/
int binary_gcd(int u, int v)
@sailfish009
sailfish009 / realsense_cloud_voxel_filtering.cpp
Created June 24, 2019 06:19 — forked from safijari/realsense_cloud_voxel_filtering.cpp
The code I used to further denoise the R200 point cloud derived from the filtered cloud(see here https://gist.github.com/safijari/fca7fa75649dbaba4b0be54f5dd742ec). Note that this will need at least PCL 1.7.2 (for Ubuntu, it's in the official PPA)
/*
Purpose of node: subscribe to a point cloud, use a VoxelGrid filter on it with a setting that
clobbers voxels with fewer than a threshold of points.
*/
#include <ros/ros.h>
#include <pcl_ros/point_cloud.h>
#include <pcl/point_types.h>
#include <iostream>
#include <pcl/filters/voxel_grid.h>
@sailfish009
sailfish009 / ProcessAsyncHelper.cs
Created August 26, 2019 01:25 — forked from AlexMAS/ProcessAsyncHelper.cs
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();
@sailfish009
sailfish009 / install-cuda-10-bionic.sh
Last active January 20, 2020 01:30 — forked from bogdan-kulynych/install-cuda-10-bionic.sh
Install CUDA 10 on Ubuntu 18.04
#!/bin/bash
# Purge existign CUDA first
sudo apt --purge remove "cublas*" "cuda*"
sudo apt --purge remove "nvidia*"
# Install CUDA Toolkit 10
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub && sudo apt update
sudo dpkg -i cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
@sailfish009
sailfish009 / pytorch-simple-rnn.py
Created October 5, 2019 04:03 — forked from spro/pytorch-simple-rnn.py
PyTorch RNN training example
import torch
import torch.nn as nn
from torch.nn import functional as F
from torch.autograd import Variable
from torch import optim
import numpy as np
import math, random
# Generating a noisy multi-sin wave
#
# Hadoop:: KafkaSpark
# Recipe:: Kafka and Spark
#
# Copyright (C) 2015 Cloudwick labs
# Contact :: [email protected]
# All rights reserved - Do Not Redistribute
#
#One machine is required as below mentioned steps are for POC purpose only.
@sailfish009
sailfish009 / spawn.cpp
Created March 26, 2020 04:04 — forked from konstantint/spawn.cpp
Example of communication with a subprocess via stdin/stdout
//
// Example of communication with a subprocess via stdin/stdout
// Author: Konstantin Tretyakov
// License: MIT
//
#include <ext/stdio_filebuf.h> // NB: Specific to libstdc++
#include <sys/wait.h>
#include <unistd.h>
#include <iostream>