Skip to content

Instantly share code, notes, and snippets.

@antoniozh
antoniozh / gist:cc16ee4010847eaa07f8a97d35737181
Created December 6, 2021 22:17
Reverse proxy DIYHue from a docker container to port 80 on a Synology DiskStation
Set up the reverse proxy with a dummy hostname on the Synology GUI which points to the DIYhue Docker container
Find the reverse proxy file /etc/nginx/sites-enabled/reverse_proxy.conf
Add the local ip address to the server_name: The server_name declaration should be looking as following:
server_name dummy_hostname xxx.xxx.xxx.xxx;
Reload nginx with `sudo nginx -s reload`
@antoniozh
antoniozh / ytcrop.sh
Last active October 30, 2020 18:22
Crops a portion of a youtube video and merges the video and audio parts without downloading the whole video.
#!/bin/bash
echo "Usage: ytcrop.sh VIDEO_LINK START_TIME DURATION [filename]"
LINKS=$(youtube-dl -g $1)
# Parse first link which is video
VIDEO_LINK=$(echo $LINKS | tr " " "\n" | head -n1 )
# Parse second link which is audio
AUDIO_LINK=$(echo $LINKS | tr " " "\n" | tail -n1 )
# echo Video link: $VIDEO_LINK
# echo Audio link: $AUDIO_LINK
@antoniozh
antoniozh / gen_pub.sh
Created April 23, 2020 12:37
Forgot your public key? Need to find it for your GitKraken setup? Use this script.
#!/bin/bash
# #1 should be the path of the private key.
ssh-keygen -y -f $1.pub > $1.pub
echo "Public key written to : $1.pub"
@antoniozh
antoniozh / verification.cs
Created April 22, 2020 13:53
Verifying X-Slack-Signature from the SlackAPI
// I had some issues with implementing the verification for the Slack Signature in the POST requests. Turns out I didn't remove the '-' in my Hash. This method works in my case.
// Copied from https://github.com/microsoft/botbuilder-dotnet/blob/master/libraries/Adapters/Microsoft.Bot.Builder.Adapters.Slack/SlackClientWrapper.cs#L673
public bool VerifySignature(HttpListenerRequest request, string body)
{
if (request == null || string.IsNullOrWhiteSpace(body))
{
return false;
}
var timestamp = request.Headers["X-Slack-Request-Timestamp"];

Keybase proof

I hereby claim:

  • I am qmager on github.
  • I am qmger (https://keybase.io/qmger) on keybase.
  • I have a public key ASDQr3R4Jb510l6GIAOUJigWNEG0Aday9VyVwOEaqP372Qo

To claim this, I am signing this object: