Skip to content

Instantly share code, notes, and snippets.

View envyen's full-sized avatar

Naveen Karuthedath envyen

View GitHub Profile
# /usr/lib/systemd/system/asus-kbd-backlight.service
[Unit]
Description=Asus Keyboard Backlight
Wants=systemd-backlight@leds:asus::kbd_backlight.service
After=systemd-backlight@leds:asus::kbd_backlight.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/chown root:backlight /sys/class/leds/asus::kbd_backlight/brightness
@envyen
envyen / ff-info.sh
Created August 2, 2017 08:55
Media info in custom JSON
#!/bin/sh
ffprobe -v quiet \
-print_format json \
-select_streams v:0 \
-show_entries stream_tags=creation_time \
-show_entries stream=height,width \
-show_entries format=size,creation_time \
-show_entries format=duration $1 \
| jq "{file: \"$1\", size: .format.size|tonumber, duration: .format.duration|tonumber, width: .streams[0].width, height: .streams[0].height, time: .streams[0].tags.creation_time }"
@envyen
envyen / gist:294834d403a7a2685c333e41ff598d00
Created July 2, 2017 03:57 — forked from robmint/gist:4753401
Basic linux framebuffer graphics setup
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
#include <linux/fb.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <stdint.h>
#include <stdbool.h>
#include <linux/input.h>
@envyen
envyen / rtsp-live.c
Created February 22, 2017 04:31 — forked from angri/rtsp-live.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <glib.h>
#define GST_USE_UNSTABLE_API
#include <gst/gst.h>
#include <gst/rtsp-server/rtsp-server.h>
audio gstreamer dev
@envyen
envyen / ffmpeg.sh
Created February 15, 2017 04:22 — forked from galori/ffmpeg.sh
ffmpeg
#!/bin/sh
echo 'usage: ./ffmpeg_to_gif.sh ~/Downloads/test.mov ~/Downloads/test.gif'
palette="/tmp/palette.png"
filters="fps=15,scale=1000:-1:flags=lanczos"
ffmpeg -v warning -i $1 -vf "$filters,palettegen" -y $palette
ffmpeg -v warning -i $1 -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y $2
@envyen
envyen / ffmpeg-build-static-cross-armhf.sh
Created February 14, 2017 10:27 — forked from spiderkeys/ffmpeg-build-static-cross-armhf.sh
Build scripts for ffmpeg static compilation and cross compilation
#!/bin/bash
export CCPREFIX="/usr/bin/arm-linux-gnueabihf-"
# Get the FFMPEG source
git clone git://source.ffmpeg.org/ffmpeg.git
cd ffmpeg
# Get library dependency sources
#include <stdio.h>
struct functions {
const char *name;
int (*func)(const char *arg);
};
int dog_func(const char *arg)
{
printf ("dog %s\n", arg);
@envyen
envyen / ArcUtils.java
Created June 30, 2016 06:05 — forked from Takhion/ArcUtils.java
Collection of methods to achieve better circular arc drawing, as Canvas.drawArc() is unreliable. See the related article: https://medium.com/p/9155f49166b8
/**
* ArcUtils.java
*
* Copyright (c) 2014 BioWink GmbH.
*
* 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
@envyen
envyen / hexdump.c
Created May 28, 2016 14:39
The following code will give you a hex dump of arbitrary memory from within your code.
#include <stdio.h>
void hexDump (char *desc, void *addr, int len) {
int i;
unsigned char buff[17];
unsigned char *pc = (unsigned char*)addr;