Skip to content

Instantly share code, notes, and snippets.

@waleedsamy
waleedsamy / Fix_SSL_unable_to_verify_the_first_certificate.md
Last active February 9, 2024 03:25
How to fix SSL unable to verify the first certificate

Open an ssl connection to site

openssl s_client -connect client-cert-missing.badssl.com:443

returns

.
.
.
---
@waleedsamy
waleedsamy / git_valid_email.sh
Created October 11, 2015 16:16
git pre-commit hook to restrict and validate author email
#!/usr/bin/bash
# This pre-commit hook will prevent any commit by unvalid author email
# or restricted email/s regex
restrict_regex=$i
email="$(git config user.email)"
if [[ "$email" =~ "^[A-Za-z0-9._%+-]+<b>@</b>[A-Za-z0-9.-]+<b>\.</b>[A-Za-z]{2,4}$" ]]
@waleedsamy
waleedsamy / ublockorigin_drop_alle_Scheiße_von_Facebook.js
Last active February 3, 2022 08:55
uBlockOrigin filters for Facebook Stories, Rooms, Contacts, Birthdays and Ads
! No Stories, Rooms, Contacts, Birthdays and Ads
facebook.com##div[data-pagelet=Stories]
facebook.com##div[data-pagelet=VideoChatHomeUnit]
facebook.com##div[data-pagelet=RightRail]
facebook.com##div[data-pagelet^="FeedUnit"]:has(a[aria-label="Sponsored"])
facebook.com##div[data-pagelet^="FeedUnit"]:has(:has-text(Suggested for You))
@waleedsamy
waleedsamy / README.md
Last active August 5, 2021 19:19 — forked from vitkin/README.md
compile wstunnel for apache 2.2.15 on centos CentOS release 6.6 (Final)

Backport WebSocket to Apache 2.2

This is my variation from the original patch and that also includes the suggested correction for the bug with secure websocket 'wss://'.

The difference is that I avoid modifying the mod_utils.c and the mod_proxy.h so that if the mod_proxy module has been embedded in the main httpd binary then it will work and you won't get the

@waleedsamy
waleedsamy / db-data-config.xml
Last active April 22, 2021 19:54
solr delta import and deletedPkQuery example
<dataConfig>
<dataSource name="DATA_SOURCE" driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://10.10.10.10:3306/rm" user="user" password="pass" />
<document name="DOC_NAMES">
<entity name="ENTITY_NAME" dataSource="DATA_SOURCE" pk="serial_no"
query = "SELECT nri.id id,
nri.name name
FROM rm.nri nri ;"
deltaImportQuery="SELECT nri.id id,
nri.name name
@waleedsamy
waleedsamy / jmx-in-docker.md
Created July 26, 2018 16:33
Run java/jmx in docker container and use visaulvm to mointor your app

I was testing an application (parser.jar) and need to limit the resource used by the app (cpu/ram) and see how different implmenation behaves.

docker run --rm -p 9010:9010 -it --memory=3000MB --cpus="2" java:8-jdk bash -c " java \
      -server \
      -XX:+UseG1GC \
      -XX:+UseStringDeduplication \
      -XX:+ExitOnOutOfMemoryError \
 -Xmx2g \
@waleedsamy
waleedsamy / awk-add-nums.sh
Last active July 16, 2018 16:45
Use AWK to add numbers from two files
awk 'FNR==NR{a[NR]=$1;next}{ print $0 " + " a[FNR] " = " $0+a[FNR]}' total-time-317.log total-time-330.log
@waleedsamy
waleedsamy / gpg.fingerprint
Last active May 11, 2018 13:55
GPG for file crypting, tag signing and email using 0x680b460f9694e494
3F9E 6349 5EA4 53A8 FF26 FDCD 680B 460F 9694 E494
@waleedsamy
waleedsamy / httpsclient.js
Last active March 22, 2018 06:47
express js https server and client with self signed certificate
const request = require('request'),
fs = require('fs'),
path = require('path'),
ca = fs.readFileSync(path.join(__dirname, 'root-ca.crt'));
const options = {
url: 'https://127.0.0.1:3443/', // any @alt_names will work
agentOptions: {
ca: ca
}
@waleedsamy
waleedsamy / Jenkinsfile
Created October 17, 2017 16:14
Jenkinsfile that extract git info, build multi-stage docker image, push to nexus and deploy to kubernetes
node {
def rock
def branch
def commit
def nexussrv = "nexus.example.de"
def nexussrv_office = "${nexussrv}:8843"
def nexussrv_datacenter = "${nexussrv}:9843"