Skip to content

Instantly share code, notes, and snippets.

@Hadryan
Hadryan / gist:1d9a0da9bf41715ff323bdd41b0fa3bb
Last active November 27, 2018 18:16 — forked from lvillarino/gist:a75b7b29bf1b298eb5ef7deec2974aad
Setup an Ubuntu 16.04, ssh to the server and run the commands
apt-get update
apt-get upgrade
sudo apt-get install build-essential libpcre3 libpcre3-dev libssl-dev unzip mc
cd /opt/
wget http://nginx.org/download/nginx-1.13.0.tar.gz
wget https://github.com/kaltura/nginx-vod-module/archive/master.zip
tar -zxvf nginx-1.13.0.tar.gz
unzip master.zip
cd nginx-1.13.0/
./configure --with-http_ssl_module --with-http_secure_link_module --add-module=../nginx-vod-module-master --with-file-aio --with-threads
@Hadryan
Hadryan / encrypt-decrypt.php
Last active January 1, 2019 14:24
MD5-hash-like, Hexadecimal encrypt / decrypt funtion for PHP
<?php
echo encrypt('Hello','f03bcafdcefd43da');
echo decrypt('427bc6d8058613003a5f2f575f269465','f03bcafdcefd43da');
// Based on Nanhe Kumar answer : https://stackoverflow.com/a/52253745/4013321
function encrypt($plainText, $key) {
$secretKey = hextobin(md5($key));
$initVector = pack("C*", 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f);
@Hadryan
Hadryan / nginx.conf
Created November 25, 2018 09:46 — forked from jrom/nginx.conf
nginx hack for multiple conditions
if ($request_uri = /) {
set $test A;
}
if ($host ~* teambox.com) {
set $test "${test}B";
}
if ($http_cookie !~* "auth_token") {
set $test "${test}C";
@Hadryan
Hadryan / nginx-boringssl-build-script-debian.sh
Created November 29, 2018 17:49 — forked from neilstuartcraig/nginx-boringssl-build-script-debian.sh
This builds NGINX from source with BoringSSL for Debian (alike?) systems with systemd (e.g. Debian Jessie)
#!/bin/bash
LATESTNGINX="1.11.10"
BUILDROOT="/tmp/boring-nginx"
# Pre-req
sudo apt-get update
sudo apt-get upgrade -y
# Install deps
https://serversforhackers.com/c/monitoring-processes-with-supervisord
# inside /etc/init.d
https://gist.github.com/danmackinlay/176149
https://github.com/Supervisor/initscripts/blob/master/debian-norrgard
https://guh.me/monitoring-long-running-processes-with-supervisord
# auto start
https://serverfault.com/a/96500/242335
https://unix.stackexchange.com/a/317452
@Hadryan
Hadryan / aubio.txt
Created December 16, 2018 20:12 — forked from tcolgate/aubio.txt
Example of using sonic-annotator to run multiple filters
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix vamp: <http://purl.org/ontology/vamp/> .
@prefix : <#> .
:transform_plugin a vamp:Plugin ;
vamp:identifier "aubiotempo" .
:transform_library a vamp:PluginLibrary ;
vamp:identifier "vamp-aubio" ;
vamp:available_plugin :transform_plugin .

Task 1: correlation between descriptors and music categories

You are given a dataset of descriptors for music recordings and additional annotations by genres and moods.

  • Analyze global correlations (across all music recordings in the dataset)
    • between descriptors within Group 1
    • between descriptors within Group 2
  • Analyze a correlation of descriptors in Group 1 and Group 2 with
    • music genres associated with the recordings
  • music moods (mood_happy, mood_sad, mood_agressive, mood_relaxed, mood_party)
@Hadryan
Hadryan / Auto Scale
Created June 14, 2019 19:07 — forked from cuongtv2004/Auto Scale
CloudFormation
"myAutoScale": {
"Type": "AWS::AutoScaling::AutoScalingGroup",
"Properties": {
"LaunchConfigurationName": {
"Ref": "myLaunchConfig"
},
"MinSize": "1",
"MaxSize": "3",
"TargetGroupARNs": [
{
#!/usr/bin/env bash
# install awscli
python2 -m pip install awscli
# create aws sym link if any issue
ln -s /usr/local/bin/aws /var/awslogs/bin/aws
# install awscli-cwlogs