Skip to content

Instantly share code, notes, and snippets.

View XJIOP's full-sized avatar

Denis Shirokov XJIOP

View GitHub Profile
@XJIOP
XJIOP / CustomTrust.java
Created February 17, 2020 14:57 — forked from reline/CustomTrust.java
Trusting self-signed certificates in Android using OkHttp
import okhttp3.*;
import okio.Buffer;
import javax.net.ssl.*;
import java.io.IOException;
import java.io.InputStream;
import java.security.GeneralSecurityException;
import java.security.KeyStore;
import java.security.cert.Certificate;
import java.security.cert.CertificateFactory;
@adddog
adddog / ffmpeg_webcam_raspberrypi.sh
Last active February 24, 2021 13:50
Install FFMPEG on Raspberry with all options
#!/bin/bash
sudo apt-get update
sudo apt-get upgrade -y
sudo apt -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev
sudo apt-get -y install libtool build-essential autoconf checkinstall git libgpac-dev libomxil-bellagio-dev libssl-dev libjack-jackd2-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev librtmp-dev libsdl1.2-dev libtheora-dev libva-dev libvdpau-dev libvorbis-dev libx11-dev libxfixes-dev pkg-config texi2html yasm zlib1g-dev xvfb nasm gcc yasm
# install ffmpeg
cd ~
@Kane-Shih
Kane-Shih / 00_READ_ME.txt
Last active December 6, 2023 18:17
Enable TLS 1.2 in Android 4.4
1. To enable TLS 1.2 in Android 4.4
Copy TLSSocketFactory.java
If using HttpsURLConnection:
=> conn.setSSLSocketFactory(new TLSSocketFactory());
Else if using OkHttp:
=> new OkHttpClient.Builder().setSocketFactory(new TLSSocketFactory()). ... .build();
Else if using HttpClient:
sample for legacy apache http library: https://github.com/Kane-Shih/TestApacheHttpClient
=> see: https://stackoverflow.com/questions/2603691/android-httpclient-and-https
@xkr47
xkr47 / letsencrypt-jetty.sh
Last active May 4, 2025 13:59
How to use Letsencrypt certificate & private key with Jetty
# input: fullchain.pem and privkey.pem as generated by the "letsencrypt-auto" script when run with
# the "auth" aka "certonly" subcommand
# convert certificate chain + private key to the PKCS#12 file format
openssl pkcs12 -export -out keystore.pkcs12 -in fullchain.pem -inkey privkey.pem
# convert PKCS#12 file into Java keystore format
keytool -importkeystore -srckeystore keystore.pkcs12 -srcstoretype PKCS12 -destkeystore keystore.jks
# don't need the PKCS#12 file anymore
@pensierinmusica
pensierinmusica / network-tuning.conf
Last active August 21, 2024 10:45
Linux sysctl configuration file for NginX
## Place this file in "/etc/sysctl.d/network-tuning.conf" and
## run "sysctl -p" to have the kernel pick the new settings up
# Avoid a smurf attack
net.ipv4.icmp_echo_ignore_broadcasts = 1
# Turn on protection for bad icmp error messages
net.ipv4.icmp_ignore_bogus_error_responses = 1
# Turn on syncookies for SYN flood attack protection