Skip to content

Instantly share code, notes, and snippets.

View Belphemur's full-sized avatar

Antoine Aflalo Belphemur

View GitHub Profile
@Belphemur
Belphemur / generate-certs.sh
Last active November 13, 2017 20:55
Generate Elastic Certificate (with CA if needed) for the full elastic stack. For Logstash use the .p8 key generated instead of the normal key.
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
FILE=${1:-instances.yml}
DAYS=${2:-36500}
BITS=${3-4096}
ES_VERSION=5.6.4
ES_DIR=/usr/share/elasticsearch/
CA_CERT=$DIR/certificates/ca/ca.crt
CA_KEY=$DIR/certificates/ca/ca.key

Keybase proof

I hereby claim:

  • I am belphemur on github.
  • I am balor (https://keybase.io/balor) on keybase.
  • I have a public key ASAAofR_lNOYzKmOkgfa5ZtPCG-tLHrCUrvmTi4afHUVsQo

To claim this, I am signing this object:

@Belphemur
Belphemur / converter.php
Created June 14, 2017 18:13
Salesforce ID 15 chars to 18 chars converter PHP
<?php
function to18char(string $inputId) {
$suffix = '';
for ($i = 0; $i < 3; $i++) {
$flags = 0;
for ($j = 0; $j < 5; $j++) {
$start = $i * 5 + $j;
$end = ($i * 5 + $j + 1) - $start;
$c = substr($inputId, $start, $end);
if (ctype_upper($c) && $c >= 'A' && $c <= 'Z') {
@Belphemur
Belphemur / post-merge
Last active March 17, 2017 15:23 — forked from sindresorhus/post-merge
git hook to run a command after `git pull` if a specified file was changed.In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed.Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
#!/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# Modified for Composer by Antoine Aflalo - www.aaflalo.me
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
#
# Author: Antoine Aflalo
# Source: https://gist.github.com/Belphemur/986ced5abe0aea303707c6df62f2c9c4/
# Referenced from: https://www.aaflalo.me/2017/03/fail2ban-and-cloudflare/
#
# To get your Cloudflare API key: https://www.cloudflare.com/my-account
#
[Definition]
// Extra JQuery Extensions and Widgets
(function($) {
$.widget("ui.combobox", {
_create: function() {
var self = this;
this.select = this.element.hide();
var select = this.select;
var id = select.attr('id');
var initial = $(select).find(":selected").text();
if (!initial){
// AudioEndTester.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "AudioEndPointLibrary.h"
#include <iostream>
#include <string>
void do_work(AudioEndPoint::AudioDeviceList playbackDevices, AudioEndPoint::AudioDeviceList recordingDevices)
{
@Belphemur
Belphemur / post-commit
Last active September 14, 2015 14:16
AppVeyor + AutoTagging + Git + C#
#! /bin/bash
basedir="$(dirname "$0")"
. $basedir/version.sh
if [ "$version" != "" ]; then
git tag -a "v$version" -m "`git log -1 --format=%s`"
echo "Created a new tag, v$version"
fi
@Belphemur
Belphemur / transmission-dlgroup.patch
Last active August 29, 2015 14:26
Patch for transmission 2.84+ for Download Group
diff -ruN transmission-2.84+/libtransmission/platform.c transmission-2.84-patched/libtransmission/platform.c
--- transmission-2.84+/libtransmission/platform.c 2015-07-30 09:56:15.405162700 +0300
+++ transmission-2.84-patched/libtransmission/platform.c 2015-07-31 12:48:59.336636000 +0300
@@ -418,6 +418,29 @@
return user_dir;
}
+const struct tr_variant*
+tr_getDefaultDownloadGroups (void)
+{
@Belphemur
Belphemur / unList.nsi
Created July 22, 2015 10:07
Uninstaller Generator
;-----------------------------------------------------------------------------------------------
; Use MD5 plugin to generate MD5 Hash and compare them instead of timestamp.
; Rename DATE -> HASH
; 2015 Antoine Aflalo aka Belphemur (antoine@aaflalo.me)
;-----------------------------------------------------------------------------------------------
; Generate list of files and directories for uninstaller with command line support (/? for help)
; 2006 Shengalts Aleksander aka Instructor (Shengalts@mail.ru)
;-----------------------------------------------------------------------------------------------
; - added file filter as command option
; 2005 Patrick Graf (patrick.graf@gmx.net)