Skip to content

Instantly share code, notes, and snippets.

View ba0f3's full-sized avatar
🇻🇳
#VietnamLeavesNoOneBehind

Huy Doan ba0f3

🇻🇳
#VietnamLeavesNoOneBehind
View GitHub Profile
@ba0f3
ba0f3 / enterprise_token.rb
Created April 17, 2024 02:51 — forked from markasoftware/enterprise_token.rb
OpenProject Enterprise mode for free
############ REPLACE app/models/enterprise_token.rb in the source code with this file! ################
############ also be sure to RESTART OpenProject after replacing the file. ################
############ it doesn't show that enterprise mode is enabled in the settings, but all ################
############ enterprise mode features, such as KanBan boards, are enabled. ################
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
@ba0f3
ba0f3 / gist:f01f6c559ed952411c2eb2366a1350e3
Last active July 13, 2021 05:54 — forked from freyes/gist:dfc3f5232526a62bbc09adc816e0477d
bluetoothd: a2dp-sink profile connect failed for AA:BB:CC:DD:EE:00: Protocol not available
Source: https://g751jy.wordpress.com/about/parrot-zik-bluetooth-headset/
https://bbs.archlinux.org/viewtopic.php?id=194006
Cached: http://webcache.googleusercontent.com/search?q=cache:4stTobIXSD0J:https://g751jy.wordpress.com/about/parrot-zik-bluetooth-headset/+&cd=3&hl=en&ct=clnk&gl=us
Bug and possible solution: actually I found a bug in that make the headset unusable, it seems that the pulse audio module: module-bluetooth-discover works only if started after the X11 session is up. So I have a workaround.
Edit the file:
/etc/pulse/default.pa
@ba0f3
ba0f3 / gist:8709b57e85c75103759f698d8471a1e3
Created April 11, 2020 05:20 — forked from sielay/gist:0aa4077829f35f5e0310f9e0cc9fdc71
Haproxy - Capture client IP when behind CloudFlare or not. Also keep x-forwarded-for in logs
frontend www-http
bind :80
bind *:443 ssl crt /etc/haproxy/certs no-sslv3
capture request header X-Forwarded-For len 50
acl is_cf req.hdr(cf-connecting-ip) -m found
http-request set-header X-Client-IP %[src] if !is_cf
http-request set-header X-Client-IP %[hdr(cf-connecting-ip)] if is_cf
@ba0f3
ba0f3 / socat-tcp-to-unix-socket.sh
Created August 29, 2019 08:34 — forked from ljjjustin/socat-tcp-to-unix-socket.sh
socat-unix-socket-to-tcp.sh
#!/bin/bash
if [ $# -ne 3 ]; then
echo "usage: $0 <unix socket file> <host> <listen port>"
exit
fi
SOCK=$1
HOST=$2
PORT=$3
@ba0f3
ba0f3 / gist:3d3e33080c0c82d6fc1717441ca411ab
Created December 3, 2018 04:13 — forked from Iristyle/gist:5005653
Configure HAProxy for userlists

Create SHA512 passwords

# make sure to use a leading space so that the command is not stored in your bash history!!
 mkpasswd -m sha-512 password1
# generates -> $6$yMgsow58.g/Z$mBjHfdVzqcF/LN.iwV23Eyqg.yGPTsp9pOwaStsJ6c4I4zL7BhucVVAkv5guf7OVRr8Pw0mHF4NrWBRCG5ci7/
 mkpasswd -m sha-512 password2
# generates -> $6$RZ86vRkQ$aRKN1HOsk6bDHBbMhS7jSo/p1NGFl4PvwY3KpU.72i./LvITi41nL84EkxOFXl.6Bmhynj/L7pYbfF0rUHtOB0
@ba0f3
ba0f3 / ssl-cert-info.sh
Created November 30, 2018 15:00
Shell script to check SSL certificate info like expiration date and subject. Taken from http://giantdorks.org/alain/shell-script-to-check-ssl-certificate-info-like-expiration-date-and-subject/
#!/bin/bash
usage()
{
cat <<EOF
Usage: $(basename $0) [options]
This shell script is a simple wrapper around the openssl binary. It uses
s_client to get certificate information from remote hosts, or x509 for local
certificate files. It can parse out some of the openssl output or just dump all
@ba0f3
ba0f3 / DumpHex.c
Created June 15, 2018 07:24 — forked from ccbrown/DumpHex.c
Compact C Hex Dump Function w/ASCII
#include <stdio.h>
void DumpHex(const void* data, size_t size) {
char ascii[17];
size_t i, j;
ascii[16] = '\0';
for (i = 0; i < size; ++i) {
printf("%02X ", ((unsigned char*)data)[i]);
if (((unsigned char*)data)[i] >= ' ' && ((unsigned char*)data)[i] <= '~') {
ascii[i % 16] = ((unsigned char*)data)[i];
@ba0f3
ba0f3 / inject.c
Created January 7, 2018 19:08 — forked from NaxAlpha/inject.c
Win32 dll injection with WriteProcessMemory and opcode patching.
#include
#include
// Source:
// http://www.emoticode.net/embed/c-plus-plus/win32-dll-injection-with-writeprocessmemory-and-opcode-patching.html
// No original Copy of page available
/***************************************************************************************************/
// Function:
// Inject
@ba0f3
ba0f3 / ubuntu_ui_toolkit_for_mac_osx.patch
Created June 26, 2016 05:35 — forked from penk/ubuntu_ui_toolkit_for_mac_osx.patch
Ported Ubuntu Components to Mac OSX and Qt 5.0.2
=== modified file 'modules/Ubuntu/Components/plugin/plugin.cpp'
--- modules/Ubuntu/Components/plugin/plugin.cpp 2013-05-21 11:06:55 +0000
+++ modules/Ubuntu/Components/plugin/plugin.cpp 2013-06-03 21:51:32 +0000
@@ -18,7 +18,7 @@
#include <QtQml>
#include <QtQuick/private/qquickimagebase_p.h>
-#include <QDBusConnection>
+//#include <QDBusConnection>
#include <QtGui/QGuiApplication>