Skip to content

Instantly share code, notes, and snippets.

View rewida17's full-sized avatar
💭
Hard working 😄

rewida17

💭
Hard working 😄
  • Poland
View GitHub Profile
@mbbroberg
mbbroberg / CURL emulation
Created September 3, 2014 19:47
Emulate curl with wget
# Emulate curl with wget
ARGS=$(echo "$*" | sed -e 's/--progress-bar /--progress=bar /' \
-e 's/-L //' \
-e 's/-I /--server-response /' \
-e 's/-s /-q /' \
-e 's/-o /-O /' \
-e 's/-C - /-c /')
wget $ARGS
@jtuttas
jtuttas / mqtt.ps1
Created April 6, 2018 09:27
MQTT mit der Powershell
Add-Type -Path 'C:\Users\jtutt\OneDrive\bin\NuGet\M2Mqtt.4.3.0.0\lib\net45\M2Mqtt.Net.dll'
$MqttClient = [uPLibrary.Networking.M2Mqtt.MqttClient]("service.joerg-tuttas.de")
#
# Verbinden
$mqttclient.Connect([guid]::NewGuid())
Register-ObjectEvent -inputObject $MqttClient -EventName MqttMsgPublishReceived -Action {Write-host "Event Found Topic: $($args[1].topic) Message $([System.Text.Encoding]::ASCII.GetString($args[1].Message))"}
$mqttClient.Subscribe("esp32/temp",0)
$MqttClient.Publish("esp32/temp", [System.Text.Encoding]::UTF8.GetBytes("{temp:17}"))
@chluehr
chluehr / date_loop.sh
Created April 26, 2012 20:28
Bash: Loop over dates
#!/bin/bash
now=`date +"%Y-%m-%d" -d "05/06/2012"`
end=`date +"%Y-%m-%d" -d "05/23/2012"`
while [ "$now" != "$end" ] ;
do
now=`date +"%Y-%m-%d" -d "$now + 1 day"`;
echo $now
done
@bluvertigo
bluvertigo / download_podcast.sh
Last active July 31, 2022 18:50 — forked from hrwgc/validate.sh
bash wget - check if file exists at url before downloading
#!/bin/bash
# simple function to check http response code before downloading a remote file
# example usage:
# if `validate_url $url >/dev/null`; then dosomething; else echo "does not exist"; fi
function validate_url () {
if [[ `curl -s --head "$1" | head -n 1 | grep "HTTP/[1-3].[0-9] [23].."` ]]
then
# 0 = true
@John07
John07 / HLS_dvr.sh
Last active June 10, 2023 10:40
A small script to make recording http live streams (HLS, those streams that work on iOS devices) nicer on a Mac. Script records the stream for a defined period of time and sends the user notifications if anything goes wrong and once it's done.
# required: ffmpeg (e.g. from homebrew), terminal-notifier from https://github.com/alloy/terminal-notifier
# you can schedule this with launchd to run e.g. weekly
# Specify in seconds how long the script should record (default here is 1 hour).
seconds=3600
# Date format for the recording file name
DATE=`date "+%d-%m-%y_%H-%M"`
# start ffmpeg recording
@yeokm1
yeokm1 / Read-only FS on Arch Linux ARM.md
Last active August 18, 2023 05:43
Set up Arch Linux ARM on Raspberry Pi to boot from and use a read-only file-system

Read-only FS on Arch Linux ARM

Unlike your typical computer where you usually shutdown properly, I cannot rely on this during the use of my Raspberry Pi. If the Raspberry Pi is improperly shutdown too many times, data corruption in the file system leading to unbootable SD card may result. So we should use a read-only file system.

Full instructions and explanations are obtained from this link but you can run these commands directly. I modified some of the instructions for personal convenience.

Login with default username: alarm, password: alarm

#Optionally enable root over SSH. The rest of these instructions assume u are in root.
@cjus
cjus / jsonval.sh
Created June 26, 2011 17:42
Extract a JSON value from a BASH script
#!/bin/bash
function jsonval {
temp=`echo $json | sed 's/\\\\\//\//g' | sed 's/[{}]//g' | awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | sed 's/\"\:\"/\|/g' | sed 's/[\,]/ /g' | sed 's/\"//g' | grep -w $prop`
echo ${temp##*|}
}
json=`curl -s -X GET http://twitter.com/users/show/$1.json`
prop='profile_image_url'
picurl=`jsonval`
@dmadisetti
dmadisetti / generate-wildcard-certificate.sh
Last active January 4, 2024 08:07 — forked from PowerKiKi/generate-wildcard-certificate.sh
Generate self-signed wildcard SSL certificate for development environment
#!/usr/bin/env bash
# print usage
DOMAIN=$1
if [ -z "$1" ]; then
echo "USAGE: $0 tld"
echo ""
echo "This will generate a non-secure self-signed wildcard certificate for "
echo "a given development tld."
echo "This should only be used in a development environment."
@s4y
s4y / capture_hls.md
Last active February 3, 2024 12:39
Capture an HLS stream from the beginning with ffmpeg
ffmpeg -live_start_index -99999 -i 'https://….m3u8' -c copy something.ts
@ssstonebraker
ssstonebraker / sed cheatsheet
Created August 2, 2013 14:06 — forked from un33k/sed cheatsheet
Sed Cheatsheet
FILE SPACING:
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed '/^$/d;G'