Skip to content

Instantly share code, notes, and snippets.

@Hadryan
Hadryan / nginx.conf
Created September 19, 2019 21:56 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@Hadryan
Hadryan / gist:a7ed8f5566639dc2f137ded5a92219bf
Created November 13, 2019 17:21
Upload file to Amazon S3 + run Amazon ET job
#Amazon Elastic Transcoder (ET)
#ET supports presets for transcoding
#http://docs.aws.amazon.com/elastictranscoder/latest/developerguide/preset-settings.html
//Let's put our video file to AWS S3. $region = "eu-west-1";
$folder = "source_videos/"; //init class to work with s3.
$s3 = new AmazonS3(); //get real file path
$real_video_file = str_replace(base_url(), ROOT, $some_file); //generate new unique video name
$unique_string = md5(uniqid() . time());
$video_file = $folder . $unique_string; //send out file to s3 storage
@Hadryan
Hadryan / simple_python_datasource.py
Created January 17, 2020 11:06 — forked from linar-jether/simple_python_datasource.py
Grafana python datasource - using pandas for timeseries and table data. inspired by and compatible with the simple json datasource
from flask import Flask, request, jsonify, json, abort
from flask_cors import CORS, cross_origin
import pandas as pd
app = Flask(__name__)
cors = CORS(app)
app.config['CORS_HEADERS'] = 'Content-Type'
#list images
docker image ls
#dive into image
docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock -e DOCKER_API_VERSION=1.37 wagoodman/dive:latest b3ec18f53aed
version: '2'
services:
graphql-engine:
image: hasura/graphql-engine:latest
ports:
- '80:8080'
restart: always
environment:
HASURA_GRAPHQL_DATABASE_URL: postgres://<rds-user>:<rds-password>@<rds-instance>:5432/<rds-dbname>
HASURA_GRAPHQL_ACCESS_KEY: mylongsecretaccesskey
@Hadryan
Hadryan / starsort.js
Created February 6, 2020 20:51 — forked from dfabulich/starsort.js
Evan Miller Ranking Items with Star Ratings, in JavaScript
"use strict";
// based on unutbu's stackoverflow answer
// https://stackoverflow.com/a/40958702/54829
// which is based on Evan Miller's blog post
// http://www.evanmiller.org/ranking-items-with-star-ratings.html
function sum(array) {
return array.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
@Hadryan
Hadryan / curl.md
Created February 19, 2020 22:01 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@Hadryan
Hadryan / kubernetes_pods_docker_disk_usage.md
Created March 3, 2020 07:09 — forked from epcim/kubernetes_pods_docker_disk_usage.md
docker disk space introspection kubernetes docker overlay

identify big pods/containers

investigage big files

DST=/mnt
find /var/lib -type f -size +1G -exec ls -lh {} \; | tee  $DST/bigfiles_var_lib_$(date "+%H%M").log
find /var/lib -type f -size +1G -exec ls -lh {} \; | awk '{ print $5 ": " $9 }' | sort -rh > $DST/bigfiles_var_lib_$(date "+%H%M").sorted.log

misbehave processes

@Hadryan
Hadryan / nginx-baduris.conf
Created March 27, 2020 19:00 — forked from cerlestes/nginx-baduris.conf
A fail2ban filter configuration to catch vulnerabilities-testing software
# Fail2Ban configuration file
#
# Regexp to catch known malicious bots that are trying
# to break into the server by testing for leaked
# sensitive directories, scripts, files.
[Definition]
badcrawlerstrings = (?:w00tw00t|wootwoot|WootWoot|WooTWooT|muieblackcat|Gh0st|Nessus)
baddirectorystrings = (?:\.\.+|cgi|cgi-bin|cgi-mod|cgi-sys|ods-cgi|scripts|db|phpMyAdmin|phpmyadmin|PHPMYADMIN|pma|PMA|phpadmin|mysql|mysqladmin|myadmin|dbadmin|sqladmin|sql-admin|sqlite|phpmanager|webadmin|wp-admin|wp-content|wp-includes|joomla|onvif|_vti_bin|xampp|\.git|te?mp|bitcoin|wallet)(?:[\d\-_].*?)?(?:/|\s|\\x5C|%%5c|\\x2F|%%2f)
@Hadryan
Hadryan / .gitignore
Created August 2, 2020 17:17 — forked from hughbiquitous/.gitignore
.gitignore for Java/IntelliJ/gradle
# From https://github.com/github/gitignore/blob/master/Gradle.gitignore
.gradle
/build/
# Ignore Gradle GUI config
gradle-app.setting
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar