Skip to content

Instantly share code, notes, and snippets.

View cstroie's full-sized avatar

Costin Stroie cstroie

  • Bitdefender
  • Bucharest, Romania
View GitHub Profile
@cstroie
cstroie / bin2bcd.c
Created April 11, 2019 14:04
bin2bcd
uint32_t bin2bcd(const uint16_t in) {
uint32_t out = 0;
for (uint8_t pos = 13; pos >= 0; pos--) {
if ((out & 0xF) >= 5)
out += 3;
if (((out & 0xF0) >> 4) >= 5)
out += (3 << 4);
if (((out & 0xF00) >> 8) >= 5)
out += (3 << 8);
out = (out << 1) | ((in >> pos) & 1);
/******************************* SOURCE LICENSE *********************************
Copyright (c) 2018 MicroModeler.
A non-exclusive, nontransferable, perpetual, royalty-free license is granted to the Licensee to
use the following Information for academic, non-profit, or government-sponsored research purposes.
Use of the following Information under this License is restricted to NON-COMMERCIAL PURPOSES ONLY.
Commercial use of the following Information requires a separately executed written license agreement.
This Information is distributed WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
@cstroie
cstroie / pbf.c
Created May 3, 2018 10:49
Chebyshev 2025-2225Hz PBF (http://www.micromodeler.com/dsp/)
/******************************* SOURCE LICENSE *********************************
Copyright (c) 2018 MicroModeler.
A non-exclusive, nontransferable, perpetual, royalty-free license is granted to the Licensee to
use the following Information for academic, non-profit, or government-sponsored research purposes.
Use of the following Information under this License is restricted to NON-COMMERCIAL PURPOSES ONLY.
Commercial use of the following Information requires a separately executed written license agreement.
This Information is distributed WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
/******************************* SOURCE LICENSE *********************************
Copyright (c) 2018 MicroModeler.
A non-exclusive, nontransferable, perpetual, royalty-free license is granted to the Licensee to
use the following Information for academic, non-profit, or government-sponsored research purposes.
Use of the following Information under this License is restricted to NON-COMMERCIAL PURPOSES ONLY.
Commercial use of the following Information requires a separately executed written license agreement.
This Information is distributed WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
sudo iw wlan0 scan | grep -io '\(^bss [^(]*\)\|\(signal: [-.0-9]*\)' | sed -e :a -e '$!N; s/\n/ /; ta' | sed 's/\.[0-9]\+ BSS /;/g' | sed 's/ signal: /,/g' | sed 's/BSS //g; s/\.00//g' | base64 -w 0 | xargs -I{} curl -v "http://api.mylnikov.org/geolocation/wifi?v=1.1&data=open&search={}"
METAR
=====
http://weather.noaa.gov/pub/data/observations/metar/decoded/LRBS.TXT
http://weather.noaa.gov/pub/data/observations/metar/stations/LRBS.TXT
TAF
===
http://weather.noaa.gov/pub/data/forecasts/taf/stations/LRBS.TXT
http://tgftp.nws.noaa.gov/data/forecasts/taf/stations/LRBS.TXT
#!/bin/sh /etc/rc.common
#
# Startup script for mjpg-streamer with file input plugin
#
START=50
STOP=50
PROG=/usr/bin/mjpg_streamer
start() {
start-stop-daemon -S -b -x "${PROG}" -- -i "input_file.so -f /tmp -n snapshot.jpg -d 5" -o "output_http.so -p 8090 -w /www/webcam -n"
#!/bin/bash
# Convert all mjpg AVI movies created by Niokon camera to mp4
if [ ! "$1" ]
then
find . -iname '*.avi' -exec "$0" "{}" \;
exit 1
fi
I="$1"
B="${I##*/}"
@cstroie
cstroie / texi2book
Created August 28, 2013 13:26
Create A5 hardcopy books form GNU texinfo files
1. Add the @afivepaper command before the end of header.
2. Create the dvi file:
$ texi2dvi4a2ps FILE.texi
3. If needed, center the content:
$ dvips -t a5 -O -11mm,0mm -o FILE.ps FILE.dvi
4. Create the PostScript book:
$ cat FILE.ps | psbook -s4 | psnup -2 -Pa5 -m0 -d0 > FILE_book.ps
5. Create the PDF file:
$ ps2pdf -sPAPERSIZE=a4 -dPDFSETTINGS=/printer FILE_book.ps FILE_book.pdf
@cstroie
cstroie / all2email.sh
Created August 13, 2012 21:20
Create playlists with all available stations of sky.fm, di.fm and JazzRadio and send them by email
#!/bin/sh
# Create playlists with all available stations of sky.fm, di.fm and JazzRadio and send them by email
# Create all playlists
for station in sky di jazz
do
for format in mp3 aac
do
`dirname $0`/radio2playlist $station $format
done