Skip to content

Instantly share code, notes, and snippets.

@adimiti
adimiti / keeper.c
Last active July 15, 2019 06:16
Keeps windows awake
#include <windows.h>
#include <stdlib.h>
void main()
{
while(1){
INPUT input;
input.type = INPUT_MOUSE;
input.mi.dx = 1;
input.mi.dy = 1;
@adimiti
adimiti / movie.sh
Created May 15, 2019 13:20
green screen
#!/bin/sh
for ((i=1;i<=100;i++)) ; do printf -v j "%05d" $i; echo $j; cp pic.png pic$j.png; done
for ((i=1;i<=100;i++)) ; do printf -v j "%05d" $i; echo $j; cp pix.png pix$j.png; done
/c/Tools/ffmpeg/bin/ffmpeg -r 1/5 -i pix%05d.png -c:v libx264 -vf "fps=25,format=yuv420p" xout.mp4
/c/Tools/ffmpeg/bin/ffmpeg -r 1/5 -i pic%05d.png -c:v libx264 -vf "fps=25,format=yuv420p" cout.mp4
/c/Tools/ffmpeg/bin/ffmpeg.exe -i xout.mp4 -i cout.mp4 -filter_complex '[1:v]colorkey=0xff0000:0.3:0.2[ckout];[0:v][ckout]overlay[out]' -map '[out]' output.avi
/c/Tools/ffmpeg/bin/ffmpeg.exe -i xout.mp4 -i cout.mp4 -filter_complex '[1:v]colorkey=0x00ff00:0.3:0.2[ckout];[0:v][ckout]overlay[out]' -map '[out]' output2.avi
#https://stackoverflow.com/questions/24961127/how-to-create-a-video-from-images-with-ffmpeg
#!/bin/sh
for ((i=1;i<=100;i++)) ;
do
printf -v j "%05d" $i;
echo $j;
done
@adimiti
adimiti / aggregation.sh
Created March 18, 2019 09:45
A script that integrates git submodules into the project
#!/bin/sh
mv .gitmodules gitmodules
cat gitmodules | grep submodule | cut -d\" -f2 | while read p;
do
echo "$p"
git rm --cached "$p"
rm -rf "$p"/.git # make sure you have backup!!
git add "$p"/ # will add files instead of commit reference
git commit -m "remove submodule $p" "$p"/
@adimiti
adimiti / BMP.html
Created March 15, 2019 12:37
BMP: support for reading the target boards VCC voltage
https://www.stm32duino.com/viewtopic.php?t=122
http://falstad.com/circuit
@adimiti
adimiti / line.c
Created March 11, 2019 16:00
Bresenham’s Line Drawing Algorithm in C
#include <stdio.h>
void image_set(int x, int y)
{
printf("(%2d, %2d)\n", x, y);
}
#define swap(X,Y) {int t; t = (Y);Y=(X);X=t;}
void __line(int x0, int y0, int x1, int y1)