Skip to content

Instantly share code, notes, and snippets.

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

rewida17

💭
Hard working 😄
  • Poland
View GitHub Profile
@rewida17
rewida17 / server.py
Created November 25, 2020 09:39 — forked from mdonkers/server.py
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
"""
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
import logging
class S(BaseHTTPRequestHandler):
@rewida17
rewida17 / get_latest_release.ps1
Last active August 31, 2020 20:24 — forked from lukechilds/get_latest_release.sh
PowerShell - Get latest release zip from GitHub
$name="creator/project"
$uri="$(Invoke-WebRequest -Method Get "https://api.github.com/repos/$name/releases/latest" | ConvertFrom-Json | Select-Object -ExpandProperty zipball_url)"
Invoke-RestMethod -Method Get -Uri $uri -OutFile last.zip
Expand-Archive -Path last.zip -DestinationPath $targetDir
ffmpeg -i input.mp4 \
-map 0:1 \
-c:a copy \
-y output.m4a
@rewida17
rewida17 / BBC_HLS_RECORD.sh
Last active February 20, 2018 15:35 — forked from John07/HLS_dvr.sh
A small script to make recording http live streams ( HLS ) on a Linux. Script records the stream for a defined period of time and sends the user notifications if anything goes wrong and once it's done.
#!/bin/bash
# required: ffmpeg notify-send or zenity ;)
# 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
#Specify in miliseconds notify timeout
notify=3000
# Date format for the recording file name
@rewida17
rewida17 / sed cheatsheet
Created January 6, 2018 00:10 — forked from ssstonebraker/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'
@rewida17
rewida17 / download_podcast.sh
Created December 23, 2017 21:11 — forked from bluvertigo/download_podcast.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