Skip to content

Instantly share code, notes, and snippets.

View h1kkan's full-sized avatar
🇺🇦
I may be slow to respond

Ivan h1kkan

🇺🇦
I may be slow to respond
View GitHub Profile
SELECT table,
formatReadableSize(sum(bytes)) as size,
min(min_date) as min_date,
max(max_date) as max_date
FROM system.parts
WHERE active
GROUP BY table
@h1kkan
h1kkan / keybase.md
Created August 3, 2020 18:06
keybase.md

Keybase proof

I hereby claim:

  • I am h1kkan on github.
  • I am h1kkan (https://keybase.io/h1kkan) on keybase.
  • I have a public key ASBdKMD9dSWDLHh1AW2mlkBNZt87GH0S2F6Gc140D3SWVAo

To claim this, I am signing this object:

@h1kkan
h1kkan / two-way-encrypt-decrypt.php
Created June 24, 2020 20:59
A simple two-way function to encrypt or decrypt a string
/**
* Encrypt and decrypt
*
* @author Nazmul Ahsan <n.mukto@gmail.com>
* @link http://nazmulahsan.me/simple-two-way-function-encrypt-decrypt-string/
*
* @param string $string string to be encrypted/decrypted
* @param string $action what to do with this? e for encrypt, d for decrypt
*/
function my_simple_crypt( $string, $action = 'e' ) {
@h1kkan
h1kkan / server.py
Created May 17, 2020 17:33 — 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):
@h1kkan
h1kkan / nginx.conf
Created November 3, 2019 22:00 — forked from FreeSlave/nginx.conf
FastDL nginx configuration for half-life server
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
@h1kkan
h1kkan / script.js
Created October 23, 2019 19:30
Wake up, Neo...reloaded
/*****************************************
WAKE UP, NEO...
Author: Jack Rugile;
MODS by Victor Casals - VSDigital
* Multiple message
* Simulation of human typing
# It locates on /etc/systemd/system/
[Unit]
Description=Cleaning unnecessary cadvisor system resources. See issue https://github.com/kubernetes/kubernetes/issues/64137.
[Service]
Slice=cadvisor-gc.slice
ExecStart=/opt/cadvisor-gc/cadvisor-gc.sh
[Install]
@h1kkan
h1kkan / cors-nginx.conf
Created April 21, 2018 16:28 — forked from michiel/cors-nginx.conf
Wide-open CORS config for nginx
#
# Wide-open CORS config for nginx
#
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
#
@h1kkan
h1kkan / gist:a51fff37b8dd4cc615cec4c4a4e65f5c
Last active April 3, 2018 12:04 — forked from JCook21/gist:3824584
Error handling file to log all PHP errors to Graylog2
<?php
/**
* This file sets up exception and error handlers to log errors to our Graylog2
* server.
*
* @author Jeremy Cook
*/
//Add the autoloader generated by composer for dependencies.
require_once 'path/to/composer/autoload.php';
@h1kkan
h1kkan / ansible_conditionals_examples.yaml
Created October 18, 2017 13:09 — forked from marcusphi/ansible_conditionals_examples.yaml
Ansible 1.3 Conditional Execution -- Very complete example with comments -- I find the conditional expressions to be ridiculously hard to get right in Ansible. I don't have a good model of what's going on under the surface so I often get it wrong. What makes it even harder is that there has been at least three different variants over the course …
---
# This has been tested with ansible 1.3 with these commands:
# ansible-playbook -i hosts ansible_conditionals_examples.yaml --extra-vars="hosts=myhosts isFirstRun=false"
# ansible-playbook -i hosts ansible_conditionals_examples.yaml --extra-vars="hosts=myhosts isFirstRun=true"
# ansible-playbook -i hosts ansible_conditionals_examples.yaml --extra-vars="hosts=myhosts"
# NB: The type of the variable is crucial!
- name: Ansible Conditionals Examples
hosts: $hosts
vars_files: