Skip to content

Instantly share code, notes, and snippets.

View lesstif's full-sized avatar

KwangSeob Jeong lesstif

View GitHub Profile
@lesstif
lesstif / InstallCert.java
Last active November 30, 2021 06:24
extract peer's SSL certificate and import to java's keystore file using keytools
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
@lesstif
lesstif / sentry-control.sh
Last active November 19, 2016 11:26
On-Premise Edition of Sentry server(https://getsentry.com) control(start, stop, status) script on RHEL/CentOS platform.
#!/bin/sh
# Source function library.
. /etc/rc.d/init.d/functions
MASTER_PID=""
CELERY_PID=""
BEAT_PID=""
if [ ! -d log ];then
@lesstif
lesstif / serve-tomcat.sh
Last active November 30, 2018 02:46
nginx virtualhost serve script for tomcat
#!/usr/bin/env bash
## Installation
# curl -o serve-tomcat.sh https://gist.githubusercontent.com/lesstif/4d162c4c8df756a65286/raw
# sudo mv serve-tomcat.sh /usr/local/bin/
# sudo chmod +x /usr/local/bin/serve-tomcat.sh
if [ "$#" -lt 2 ]; then
echo "Error: missing required minimal 2 parameters.";
echo "Usage: ";
@lesstif
lesstif / serve-php.sh
Last active March 21, 2021 06:23
nginx php-fpm virtual host serve script for RHEL/CentOS, Ubuntu distro. Run "curl -o serve-php.sh https://gist.githubusercontent.com/lesstif/82c107282241c7a52ad9/raw && sudo mv serve-php.sh /usr/local/bin/ && sudo chmod +x /usr/local/bin/serve-php.sh "
#!/usr/bin/env bash
## Installation
## curl -o /usr/local/bin/serve-php.sh https://gist.githubusercontent.com/lesstif/82c107282241c7a52ad9/raw
## chmod +x /usr/local/bin/serve-php.sh
SA="/etc/nginx/sites-available/"
SE="/etc/nginx/sites-enabled/"
test=0
@Nihisil
Nihisil / jail.local
Last active September 5, 2023 06:20
Send notifications to the Slack from fail2ban
...
action_with_slack_notification = %(banaction)s[name=%(__name__)s, port="%(port)$
slack[name=%(__name__)s]
action = %(action_with_slack_notification)s
...
@fevangelou
fevangelou / my.cnf
Last active August 22, 2025 08:47
Optimized my.cnf configuration for MySQL/MariaDB (on Ubuntu, CentOS, Almalinux etc. servers)
# === Optimized my.cnf configuration for MySQL/MariaDB (on Ubuntu, CentOS, Almalinux etc. servers) ===
#
# by Fotis Evangelou, developer of Engintron (engintron.com)
#
# ~ Updated September 2024 ~
#
#
# The settings provided below are a starting point for a 8-16 GB RAM server with 4-8 CPU cores.
# If you have different resources available you should adjust accordingly to save CPU, RAM & disk I/O usage.
#
@jrmadsen67
jrmadsen67 / gist:bd0f9ad0ef1ed6bb594e
Last active August 19, 2024 10:37
Laravel Quick Tip: Handling CsrfToken Expiration gracefully
Quick tip for handling CSRF Token Expiration - common issue is when you use csrf protection is that if
a form sits there for a while (like a login form, but any the same) the csrf token in the form will
expire & throw a strange error.
Handling it is simple, and is a good lesson for dealing with other types of errors in a custom manner.
In Middleware you will see a file VerifyCsrfToken.php and be tempted to handle things there. DON'T!
Instead, look at your app/Exceptions/Handler.php, at the render($request, Exception $e) function.
All of your exceptions go through here, unless you have excluded them in the $dontReport array at the
@lesstif
lesstif / shutdown_graceful.sh
Last active August 26, 2020 08:42
tomcat shutdown gracefully script
#!/bin/sh
killproc() {
local servicename=$1
local user=$2
local signal="TERM"
if [ "$#" = 0 ] ; then
echo $"Usage: killproc {servicename} {user} {signal}"
return 1
@aczietlow
aczietlow / selenium-php-webdriver-cheatsheet.md
Last active May 18, 2025 18:53 — forked from huangzhichong/selenium-webdriver-cheatsheet.md
Cheat sheet for using php webdriver (facebook/webdriver).

Webdriver PHP API workthough

  • Open a browser

    # start an instance of firefox with selenium-webdriver
    
    $browser_type = 'firefox'
    $host = 'http://localhost:4444/wd/hub'
    

$capabilities = array(\WebDriverCapabilityType::BROWSER_NAME => $browser_type);

@lesstif
lesstif / tomcat-service.sh
Last active July 27, 2021 01:26
RHEL/CentOS tomcat7 init.d service script.
#!/bin/bash
#
# tomcat
#
# chkconfig: 345 96 30
# description: Start up the Tomcat servlet engine.
#
# processname: java
# pidfile: /var/run/tomcat.pid
#