Skip to content

Instantly share code, notes, and snippets.

View akbaryahya's full-sized avatar

Akbar Yahya akbaryahya

View GitHub Profile
@mojoaxel
mojoaxel / getImageAndSaveToFTP.sh
Created January 14, 2016 19:42
Upload image from AirCam to Wunderground (FTP)
#!/bin/bash
# Download image from AirCam
curl --insecure -o image.jpg https://XXX.XXX.XXX.XXX/snapshot.cgi?chan=1
# create folder archive if it doesn't already exist
mkdir -p archive
# save image to archive
cp image.jpg archive/webcam_$(date +"%Y%m%d-%H%M").jpg
@maxrice
maxrice / resizer.php
Created August 30, 2012 11:59
Resize images to a specific size while maintaining original aspect-ratio via PHP CLI
<?php
// only process image files
$accepted_extensions = array( 'jpg', 'jpeg', 'png' );
// set final size of cropped image
$image_size_width = 892;
$image_size_height = 892;
//only process files in directory that script is in
@dodiku
dodiku / device_orientation.js
Last active July 23, 2019 16:08
This code gets the device movement and orientation data, and appends it to the DOM's body.
/* might be good to use this library -
https://github.com/dorukeker/gyronorm.js */
function handleOrientation(event) {
var absolute = event.absolute;
var alpha = event.alpha;
var beta = event.beta;
var gamma = event.gamma;
$(".alpha").text("alpha (z axis, 0 to 360): " + alpha);
@megasaturnv
megasaturnv / mjpeg_Snapshot.php
Last active December 13, 2019 10:33
PHP motion jpeg mjpeg snapshot single frame with or without http auth. No temporary file needed
<?php
//Megasaturnv 2018-01-12
$camurl="http://192.168.1.100:8081/"; // Mjpeg URL
//$camurl="http://username:password@192.168.1.100:8081/" // HTTP Auth mjpeg URL (optional)
$boundary="--BoundaryString"; // $boundary = The boundary string between jpegs in an mjpeg stream
//NOTE: $boundary changes between mjpeg stream providers. For example, https://github.com/Motion-Project/motion uses '--BoundaryString'. https://github.com/ZoneMinder/ZoneMinder uses '--ZoneMinderFrame'. To find out $boundary for your stream you will need to save 1 or more frames of the mjpeg and open it with a text editor. --<boundary string> should be visible on the first line
$f = fopen($camurl, "r"); // Open mjpeg url as $f in readonly mode
$r = ""; // Set $r to blank variable
if($f) {
// a really, really simple proxy to request
// non-CORS enabled webservices
// Drop this script on your server and prepend
// the url you want to access like e.g.
// $.getJSON("http://pathtouyourserver.com/folderwiththisscript/corsproxy.php?url=http://theapiwithoutcors.com").success(....
//
// You find a more sophisticated one here: http://benalman.com/projects/php-simple-proxy/
<?php
$url = $_GET['url'];
$content = file_get_contents($url);
@rochmad
rochmad / Netdata windows 10 bash mode
Last active April 25, 2020 07:21
Install firehol/NETDATA into WINDOWS 10 subsystem linux/Ubuntu
first off all, let windows use subsystem of linux, you can go here >>> https://www.howtogeek.com/249966/how-to-install-and-use-the-linux-bash-shell-on-windows-10/
and then go to firehol netdata https://github.com/firehol/netdata/wiki/Installation#x86_64-pre-built-binary-for-any-linux
and follow this step
1. open windows+R and type bash
2. do at root(optional)
3. lookinto "x86_64 pre-built binary for any Linux"
4. DO this "#bash <(curl -Ss https://my-netdata.io/kickstart-static64.sh)"
@laurenarcher
laurenarcher / livestreamingyoutube
Created November 21, 2014 14:13
Livestreaming to Youtube Live, Ubuntu, Linux FFMPEG
Terminal Commands:
One webcam:
ffmpeg -f alsa -ac 2 -i hw:1,0 -f v4l2 -s 1280x720 -r 10 -i /dev/video1 -vcodec libx264 -pix_fmt yuv420p -preset ultrafast -r 25 -g 20 -b:v 2500k -codec:a libmp3lame -ar 44100 -threads 6 -b:a 11025 -bufsize 512k -f flv rtmp://a.rtmp.youtube.com/live2/YOURSTREAMNAMEHERE
Two webcam overlay:
ffmpeg -f alsa -ac 2 -i hw:1,0 -f v4l2 -s 1280x720 -r 10 -i /dev/video1 -f v4l2 -s 320x240 -r 10 -i /dev/video0 -filter_complex "[1:v]setpts=PTS-STARTPTS[bg]; [2:v]setpts=PTS-STARTPTS[fg]; [bg][fg]overlay=shortest=1 [out]" -map "[out]" -map 0:a -vcodec libx264 -pix_fmt yuv420p -preset veryfast -r 25 -g 20 -b:v 2500k -codec:a libmp3lame -ar 44100 -threads 6 -b:a 11025 -bufsize 512k -f flv rtmp://a.rtmp.youtube.com/live2/YOURSTREAMNAMEHERE
@suggoitanoshi
suggoitanoshi / docker-compose.yml
Last active April 22, 2022 04:38
A bundled docker-compose for docker-gc (https://hub.docker.com/r/siakbary/dockergc)
version: '3'
services:
mongodb:
image: mongo
ports:
- "27017:27017"
grasscutter:
image: siakbary/dockergc:dev-1.7
command: -d 'mongodb://mongodb:27017' -b 'localhost' # EDIT: database now uses URI
@fasiha
fasiha / README.md
Last active October 2, 2022 22:36
Pitch (fundamental frequency) detection using (1) harmonic product spectrum, (2) Blackman-Tukey spectral estimator, and (3) Welch spectral estimator.

Experimenting with pitch detection and spectral estimators

See the question and discussion on StackOverflow: How to get the fundamental frequency using Harmonic Product Spectrum?.

We’re trying to estimate the fundamental frequency of a voiced A4 note (440 Hz). (See the question for link to audio clip.)

Harmonic product spectrum

Result: full data, 0 to 2 KHz

@tosbourn
tosbourn / facebook_warning.html
Created February 4, 2017 23:37
How to recreate Facebook's console warning
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<script type="text/javascript">
const warningTitleCSS = 'color:red; font-size:60px; font-weight: bold; -webkit-text-stroke: 1px black;';
const warningDescCSS = 'font-size: 18px;';