Skip to content

Instantly share code, notes, and snippets.

@michailw
michailw / nginx_socket_write.te
Created February 13, 2017 18:53
SELinux Nginx socket write Ansible
module nginx_socket_write 1.0;
require {
type httpd_t;
type var_t;
type http_cache_port_t;
class sock_file write;
class tcp_socket name_connect;
}
@michailw
michailw / gist:bc780e8f7273fe59af1d98b35fa1aaef
Last active June 17, 2017 18:30
Raspberry Headless setup
https://downloads.raspberrypi.org/raspbian_lite_latest
/etc/network/interfaces
auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
- name: "Create temporary directory"
become: yes
file:
path: "/tmp/raspbian"
state: directory
- name: "Download Raspbian image"
become: yes
get_url:
url: "https://downloads.raspberrypi.org/raspbian_lite_latest"
@michailw
michailw / test.php
Last active October 22, 2017 09:30
<?php
class A {
public function b($username, $password)
{
$logged = $this->checkLogin($username, $password);
if (!$logged || $this->noOfLogins++ >= 3) {
echo "Konto zablokowane";
return false;
}
minikube version
minikube status
minikube start
minikube stop
minikube restart
minikube ip
kubectl version
kubectl cluster-info
@michailw
michailw / cleanS3cmd.sh
Last active April 3, 2019 19:33
Cleans up S3 bucket using s3cmd command from older backups
#!/bin/bash
BUCKET_NAME=$1
NOW=$(date +"%s")
NOW_YEAR=$(date +"%Y")
PAST=$(( $NOW - (7 * 3600 * 24) ))
PAST_STRING=$(date -d @$PAST +"%Y-%m-%d")
LOG_PATH="/tmp/bucket-cleanup_$(date +"%Y-%m-%d").log"