Skip to content

Instantly share code, notes, and snippets.

View ddmitov's full-sized avatar

Dimitar D. Mitov ddmitov

View GitHub Profile
@ruanbekker
ruanbekker / minio_events_webhook.md
Last active March 25, 2024 01:43
Minio Events with Bucket Notifications
@jdarpinian
jdarpinian / executable.c
Last active March 20, 2024 15:28
Add one line to your C/C++ source to make it executable.
///bin/true;COMPILER_OPTIONS="-g -Wall -Wextra --std=c99 -O1 -fsanitize=address,undefined";THIS_FILE="$(cd "$(dirname "$0")"; pwd -P)/$(basename "$0")";OUT_FILE="/tmp/build-cache/$THIS_FILE";mkdir -p "$(dirname "$OUT_FILE")";test "$THIS_FILE" -ot "$OUT_FILE" || $(which clang || which gcc) $COMPILER_OPTIONS -xc "$THIS_FILE" -o "$OUT_FILE" || exit;exec "$OUT_FILE" "$@"
#include <stdio.h>
int main() {
printf("Hello world!\n");
return 0;
}
@dotmanila
dotmanila / clickhouse-changelog.py
Last active February 12, 2022 18:35
Python MySQL Binlog Change Data Capture for Clickhouse Example
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import sys
import pymysql.cursors
from pymysqlreplication import BinLogStreamReader
from pymysqlreplication.row_event import (
DeleteRowsEvent,
@heitorlessa
heitorlessa / example_minio_boto3.py
Created August 30, 2016 14:18
Minio with python boto3
# Sample as to how to initialize s3 client to work with Minio API compatible - https://github.com/minio/minio
# AWS CLI counterpart - https://docs.minio.io/docs/aws-cli-with-minio
import boto3
s3 = boto3.resource('s3',
endpoint_url='http://<minio_IP>:9000',
config=boto3.session.Config(signature_version='s3v4')
)
@steinwaywhw
steinwaywhw / One Liner to Download the Latest Release from Github Repo.md
Last active May 5, 2024 20:02
One Liner to Download the Latest Release from Github Repo
  • Use curl to get the JSON response for the latest release
  • Use grep to find the line containing file URL
  • Use cut and tr to extract the URL
  • Use wget to download it
curl -s https://api.github.com/repos/jgm/pandoc/releases/latest \
| grep "browser_download_url.*deb" \
| cut -d : -f 2,3 \
| tr -d \" \
@subfuzion
subfuzion / curl.md
Last active May 6, 2024 09:53
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.

@mw-ferretti
mw-ferretti / README.md
Last active January 28, 2023 20:44
Paypal button on markdown github

Steps:

<!-- Sample of code generated --> 
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="RGQ8NSYPA59FL">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/pt_BR/i/scr/pixel.gif" width="1" height="1">
@srv89
srv89 / python_email.py
Last active January 29, 2024 00:24
Python code for sending HTML email (Attachment + Multiple Recipients )
__author__ = 'srv'
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.application import MIMEApplication
username = '' # Email Address from the email you want to send an email
password = '' # Password
server = smtplib.SMTP('')
@dex4er
dex4er / mojo-app.pl
Last active February 12, 2019 11:53
Mojolicious + PAR::Packer without --addfile
#!/usr/bin/env perl
use v5.10;
use strict;
use warnings;
use Mojolicious::Lite;
# Explicit use as a helper for PAR
@jnormore
jnormore / bootstrap3-alert-box.js
Last active November 10, 2019 13:07
Bootstrap 3 alert and confirm modals. Overrides window.alert normally, but window.confirm override requires a callback function to be passed to get result. Optional arguments for modal title and confirm button label.
window.alert = function(message, title) {
if($("#bootstrap-alert-box-modal").length == 0) {
$("body").append('<div id="bootstrap-alert-box-modal" class="modal fade">\
<div class="modal-dialog">\
<div class="modal-content">\
<div class="modal-header" style="min-height:40px;">\
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>\
<h4 class="modal-title"></h4>\
</div>\
<div class="modal-body"><p></p></div>\