Skip to content

Instantly share code, notes, and snippets.

@wwwins
wwwins / GetLightSource.py
Created March 13, 2017 07:37
Get base station positions and direction matrices.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import argparse
if len(sys.argv) < 3:
print("""
Usage:
python getlightsource.py "b0 origin 2.113770 1.062783 1.846117 matrix 0.738652 -0.146207 0.658040 0.033019 0.982870 0.181316 -0.673277 -0.112202 0.730827" "b1 origin -2.054813 1.115880 -1.950253 matrix -0.653711 0.083806 -0.752089 0.046773 0.996423 0.070377 0.755297 0.010829 -0.655293"
""")
@wwwins
wwwins / args-sed.sh
Created March 13, 2017 07:34
[args+sed] replace last character
$ echo "2.113770 1.062783 1.846117"|xargs -n 1|sed 's/[0-9]$/f,/'
2.11377f,
1.06278f,
1.84611f,
@wwwins
wwwins / c920.md
Last active December 8, 2022 09:37
live streaming from raspberry pi with logitech usb c920

video stream(v4l2-ctl)

v4l2-ctl --list-devices
mmal service 16.1 (platform:bcm2835-v4l2):
        /dev/video0

HD Pro Webcam C920 (usb-3f980000.usb-1.2):
        /dev/video1
@wwwins
wwwins / readme.md
Last active December 6, 2016 04:13 — forked from max-mapper/readme.md
ffmpeg youtube live event rtmp stream from raspberry pi with raspi camera (raspivid)

youtube

  1. compile ffmpeg for arm https://github.com/fiorix/ffmpeg-arm
  2. create youtube 'live event'. get rtmp url + session id
  3. run this:
raspivid -o - -t 0 -vf -hf -fps 30 -b 6000000 | ffmpeg -re -ar 44100 -ac 2 -acodec pcm_s16le -f s16le -ac 2 -i /dev/zero -f h264 -i - -vcodec copy -acodec aac -ab 128k -g 50 -strict experimental -f flv rtmp://a.rtmp.youtube.com/live2/<SESSION>

you can tweak -b and -fps to your liking. the settings above work well for 1080p. by not specifying width or height we get the full 1920x1080 resolution from the raspi camera

@wwwins
wwwins / node-sender.cpp
Created January 4, 2016 05:28
Sender for Raspberry Pi.
#include <cstdlib>
#include <iostream>
#include <sstream>
#include <string>
#include <RF24/RF24.h>
#include <unistd.h>
using namespace std;
//
// Hardware configuration
@wwwins
wwwins / node-receiver.cpp
Last active January 14, 2016 03:19
Receiver For Arduino.
#include <SPI.h>
#include "RF24.h"
/************* USER Configuration *****************************/
// Hardware configuration
RF24 radio(9, 10); // Set up nRF24L01 radio on SPI bus plus pins 7 & 8
/***************************************************************/
const uint64_t pipes[2] = { 0xABCDABCD71LL, 0x544d52687CLL }; // Radio pipe addresses for the 2 nodes to communicate.
@wwwins
wwwins / nRF24-transfer-rpi.cpp
Last active December 31, 2015 08:00
Sending From Arduino To Raspberry Pi.
#include <cstdlib>
#include <iostream>
#include <sstream>
#include <string>
#include <RF24/RF24.h>
#include <unistd.h>
using namespace std;
//
// Hardware configuration
@wwwins
wwwins / nRF24-transfer.cpp
Last active December 31, 2015 07:58
Sending From Arduino.
#include <SPI.h>
#include "RF24.h"
/************* USER Configuration *****************************/
// Hardware configuration
RF24 radio(9, 10); // Set up nRF24L01 radio on SPI bus plus pins 7 & 8
/***************************************************************/
const uint64_t pipes[2] = { 0xABCDABCD71LL, 0x544d52687CLL }; // Radio pipe addresses for the 2 nodes to communicate.
#import <UIKit/UIKit.h>
@interface UILabel (ContentSize)
- (CGSize)contentSize;
@end
//
// UINavigationBar+CustomHeight.h
//
// Copyright (c) 2014 Maciej Swic
//
// 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