Skip to content

Instantly share code, notes, and snippets.

@Antti
Antti / Neewer-RGB660_PRO_ReverseEngNotes.txt
Created January 20, 2022 23:59 — forked from JDogHerman/Neewer-RGB660_PRO_ReverseEngNotes.txt
Notes on the reverse engineering of the data for the Neewer-RGB660 PRO leveraging bluetooth low energy.
Notes on the reverse engineering of the data for the Neewer-RGB660 PRO leveraging bluetooth low energy.
NEEWER-RGB660 PRO
02 41 00 0C 00 08 00 04 00 52 0E 00 78 81 01 01 FB
Preamble 02 04 00 0C 00 08 00 04 00 52 0E 00 Value 78 81 01 01 FB
Service UUID: 69400001b5a3f393e0a9e50e24dcca99
Caracteristic: 69400002b5a3f393e0a9e50e24dcca99
Properties: WRITE, WRITE NO RESPONSE
@Antti
Antti / latency.txt
Created December 20, 2018 11:18 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@Antti
Antti / HungarianCUDA.cu
Created February 19, 2018 22:18 — forked from paclopes/HungarianCUDA.cu
Fast CUDA implementation of the Hungarian algorithm.
// Fast Block Distributed CUDA Implementation of the Hungarian Algorithm
//
// Annex to the paper:
// Paulo A. C. Lopes, Satyendra Singh Yadav, Aleksandar Ilic, Sarat Kumar Patra ,
// "Fast Block Distributed CUDA Implementation of the Hungarian Algorithm",
// Parallel Computing
//
// Hungarian algorithm:
// (This algorithm was modified to result in an efficient GPU implementation, see paper)
//
module Sass::Script::Functions
def user_color
color_values = options[:custom][:user].color.
scan(/^#?(..?)(..?)(..?)$/).first.
map {|num| num.ljust(2, num).to_i(16)}
Sass::Script::Color.new(color_values)
end
end
use std::io;
fn main() {
eval(bytes!("++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.")); // I stole this off of wikipedia, sorry, wikipedia :(
}
fn eval(program: &[u8]) {
let mut pointer = 0u;
let mut memory = [0u8, ..1024];
let mut jmp_stack = vec!();
@Antti
Antti / config.ru
Created March 6, 2012 12:32
Rails Lightweight Stack. Most of this is detailed on Crafting Rails Applications - http://pragprog.com/book/jvrails/crafting-rails-applications
# Run this file with `RAILS_ENV=production rackup -p 3000 -s thin`
# Be sure to have rails and thin installed.
require "rubygems"
# We are not loading Active Record, nor the Assets Pipeline, etc.
# This could also be in your Gemfile.
gem "actionpack", "~> 3.2"
gem "railties", "~> 3.2"
# The following lines should come as no surprise. Except by
@Antti
Antti / gist:1106691
Created July 26, 2011 12:57
Ruby Style Guide
Original Source: https://github.com/chneukirchen/styleguide
= Christian Neukirchen's Ruby Style Guide
You may not like all rules presented here, but they work very well for
me and have helped producing high quality code. Everyone is free to
code however they want, write and follow their own style guides, but
when you contribute to my code, please follow these rules:
rm -R $HOME/Desktop/server-{1,2}
mkdir -p $HOME/Desktop/server-{1,2}
mysql_install_db --datadir=$HOME/Desktop/server-1 && mysqld --server-id 1 -h ~/Desktop/server-1 --socket ~/Desktop/server-1/mysql.sock -P 10001 --log-bin &
mysql_install_db --datadir=$HOME/Desktop/server-2 && mysqld --server-id 2 -h ~/Desktop/server-2 --socket ~/Desktop/server-2/mysql.sock -P 10002 --master-port=10001 --master-host=127.0.0.1 --master-user=root &
alias sql-master="mysql -h127.0.0.1 -P10001 -uroot"
alias sql-slave="mysql -h127.0.0.1 -P10002 -uroot"
alias sql-master-admin="mysqladmin -h127.0.0.1 -P10001 -uroot"
@Antti
Antti / irbrc.rb
Created June 3, 2010 13:26 — forked from wycats/irbrc.rb
module Matz
def self.included(*)
puts <<-MATZ
Simplicity is NOT a Goal
------------------------
Things too simple are difficult
Things too complex are difficult
@Antti
Antti / floppy.rb
Created February 7, 2010 21:28 — forked from pjb3/floppy.rb
class Floppy
def method_missing(method, *args)
super unless args.length > 0 && method.to_s[-1..-1] == "="
if args.first.is_a?(Proc)
(class << self; self; end).class_eval do
define_method(method.to_s[0..-2].to_sym, args.first)
end
else
(class << self; self; end).send(:attr_accessor, method.to_s[0...-1])