Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
#
# description: Tomcat Start Stop Restart
# processname: tomcat
# chkconfig: 234 20 80
#
# Tomcat 8 start/stop/status init.d script
# Initially forked from: https://gist.github.com/valotas/1000094
# @author: Miglen Evlogiev <bash@miglen.com>
#
@highel
highel / install_arimo.sh
Last active June 22, 2016 20:32
Installs Arimo font to OpenJDK inside CentOS 7
jre=`update-alternatives --display java |grep -om 1 '\ /.*jdk.*jre'`
jre=$jre'/lib/fonts'
unzip -o -j arimo.zip "*.ttf" -d $jre
echo Installed Arimo font to $jre
@highel
highel / gist:81ee0b3da8bf3c6c31490ea87af88fac
Last active June 30, 2016 15:50
Compressing connector for Pentaho
Enable GZIP Traffic compression for slow LAN - actually sacrifices performance to much faster network access - you should not apply this mindlessly
server.xml
<Connector
className="Http11Nio2Protocol"
enableLookups="false"
compression="force"
URIEncoding="UTF-8" port="8080" protocol="HTTP/1.1"
connectionTimeout="40000"
socket.directBuffer="true"
redirectPort="8443" />
@highel
highel / keycloak.sh
Created July 20, 2016 17:30 — forked from paoloantinori/keycloak.sh
Keycloak Admin API Rest Example
#!/bin/bash
export TKN=$(curl -X POST 'http://localhost:8080/auth/realms/master/protocol/openid-connect/token' \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "username=admin" \
-d 'password=admin' \
-d 'grant_type=password' \
-d 'client_id=admin-cli' | jq -r '.access_token')
curl -X GET 'http://localhost:8080/auth/admin/realms' \
@highel
highel / gist:f2c1867fd764a4b1374886fec3accb36
Created July 25, 2016 16:24
CryptoPRO Tomcat Connector
<Connector port="8443" maxHttpHeaderSize="8192"
protocol="org.apache.coyote.http11.Http11NioProtocol" SSLEnabled="true"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" disableUploadTimeout="true"
acceptCount="100" scheme="https" secure="true"
clientAuth="false"
algorithm="GostX509"
keystoreProvider="JCP"
sslProtocol="GostTLS"
keystoreType="HDImageStore"
@highel
highel / SpringBootExternalTest.java
Last active October 25, 2017 12:03
Launch full fledged Spring Boot application in separate test. This is only for integration testing with HTTP protocol, normally you should use Spring Test MVC framework to test controllers and Spring less unit testing of separate classes.
public class SpringBootExternalTest {
static CompletableFuture<Throwable> initializationException;
@BeforeClass
public static void startSpringContext() {
initializationException = new CompletableFuture<>();
Thread appThread = new Thread(() -> {
SpringApplication springApplication = new SpringApplication(
SpringBootApplication.class);
springApplication.addListeners((ApplicationListener<ApplicationReadyEvent>) event -> initializationException.complete(null));
@highel
highel / Split.java
Created January 5, 2018 17:35
split text with delimeters
public class Split {
public static Pattern whitespace = Pattern.compile("\\s+");
public static void main(String[] s) {
List<Block> blocks = splitWithDelimiters("r2ejh2j 24 3");
blocks = splitWithDelimiters("СЛОН ТОПТПАИТ 24 3343");
blocks = splitWithDelimiters(" топтает ");
blocks = splitWithDelimiters(" тооп");
blocks = splitWithDelimiters(" ");
blocks = splitWithDelimiters("");
@highel
highel / build.gradle
Created January 6, 2018 16:55 — forked from AntonKosov/build.gradle
android + gradle + idea + git + private keystore
// Tags:
// Version name: ignore leading non-digits and everything after the first underscore
// Version code: take digits after the first underscore
// e.g. tag xxx1.2.3.foo-bar_15_baz will yield versionName 1.2.3.foo-bar and versionCode 15
// Output filename:
// <project name>-<release|debug>-<version (from last tag)|"dev" (doesn't have tag)>[-NOTRELEASE (exist changes after last tag)]-<last short commit hash>[-dirty (exist changes)].apk
// Sample:
// myproject-debug-dev-094cf50.apk
// myproject-debug-0.1.0-094cf50.apk
@highel
highel / remove_sms.py
Last active September 16, 2023 22:43 — forked from GWuk/zte_sms.py
Remove all SMS from ZTE MF283V modem. This modem has tendency to overflow after you cant view SMS in UI. Tested on Russian Tele 2 version.
import requests
import json
import base64
url = 'http://192.168.0.1/goform/goform_get_cmd_process?isTest=false&cmd=sms_data_total&page=0&data_per_page=500&mem_store=1&tags=10&order_by=order+by+id+desc'
s = requests.Session()
s.headers.update({'Host': '192.168.0.1'})
s.headers.update({'Referer': 'http://192.168.0.1/index.html'})
r = s.get(url)
@highel
highel / pillow-simd-libjpeg-turbo.md
Created November 13, 2023 22:59 — forked from willprice/pillow-simd-libjpeg-turbo.md
Pillow-SIMD with libjpeg/turbo

sudo apt-get install gcc-multilib

# The following steps are based on
# https://docs.fast.ai/performance.html#installation

$ conda install -y -c conda-forge gxx_linux-64 
$ conda uninstall -y --force jpeg libtiff
$ conda install -y -c conda-forge libjpeg-turbo --no-deps