Skip to content

Instantly share code, notes, and snippets.

View cubapp's full-sized avatar

Jakub Urbanec cubapp

View GitHub Profile
@cubapp
cubapp / adb-cast.sh
Created March 12, 2019 11:03
ADB way to cast screen from Android device to ffplay
adb devices
echo "Wait at least 10secs and use the Android screen"
adb shell screenrecord --output-format=h264 - | ffplay -probesize 1M -
@cubapp
cubapp / last5.c
Created January 16, 2018 07:50
Last 5 - get the last 5 characters from each line of a text file. From http://www.thelinuxrain.com/articles/bash-drivers-start-your-engines
#include <stdio.h>
#include <stdlib.h>
// from http://www.thelinuxrain.com/articles/bash-drivers-start-your-engines
// C version is about 2-4 times faster than perl version.
int main (int argc, char *argv[])
{
if (argc != 2){
printf("Usage: %s filename\n", argv[0]);
@cubapp
cubapp / fizzbuzz-ugly.c
Created August 28, 2017 09:00
The FizzBuzz.c the ugly way ...
#include <stdio.h>
void main(void){for(int i=0; i<=99; (++i%15)?(i%5)?(i%3)?printf("%d\n",i):printf("Fizz\n"):printf("Buzz\n"):printf("FizzBuzz\n"));}
@cubapp
cubapp / fizzbuzz.c
Created August 28, 2017 08:51
FizzBuZZ the C way - inspired by http://codepad.org/fizzbuzz
#include <stdio.h>
int main(void)
{
int i;
for(i=1; i<=100; i++)
(i%15)?(i%5)?(i%3)?printf("%d\n",i):printf("Fizz\n"):printf("Buzz\n"):printf("FizzBuzz\n");
return 0;
}

Keybase proof

I hereby claim:

  • I am cubapp on github.
  • I am cuba (https://keybase.io/cuba) on keybase.
  • I have a public key ASBOrgm7hOdzr7GE_phGhxg4w3QKKcG6TG5Tn4i7aqd7Vgo

To claim this, I am signing this object:

@cubapp
cubapp / adjust-2-sea-pressure.py
Last active February 28, 2024 20:22
Python: How to get the adjusted-to-sea level barometric pressure from actual pressure, temperature and height above the sea level
# Actual atmospheric pressure in hPa
aap = 990
# Actual temperature in Celsius
atc = 10
# Height above sea level
hasl = 500
# Adjusted-to-the-sea barometric pressure
a2ts = aap + ((aap * 9.80665 * hasl)/(287 * (273 + atc + (hasl/400))))