Skip to content

Instantly share code, notes, and snippets.

@DucHM
DucHM / php-ping.php
Created July 23, 2021 02:44 — forked from k0nsl/php-ping.php
PHP ping script
<?php
/*
*
* Use the examples below to add your own servers. Coded by clone1018 [?]
*
*/
$title = "Simple Server Status"; // website's title
$servers = array(
'Google Web Search' => array(
@DucHM
DucHM / regex-japanese.txt
Created June 25, 2021 16:32 — forked from terrancesnyder/regex-japanese.txt
Regex for Japanese
Regex for matching ALL Japanese common & uncommon Kanji (4e00 – 9fcf) ~ The Big Kahuna!
([一-龯])
Regex for matching Hirgana or Katakana
([ぁ-んァ-ン])
Regex for matching Non-Hirgana or Non-Katakana
([^ぁ-んァ-ン])
Regex for matching Hirgana or Katakana or basic punctuation (、。’)
@DucHM
DucHM / RVObserver.java
Created December 2, 2020 07:54 — forked from IshankGulati/RVObserver.java
Base Adapter and RecyclerView.ViewHolder implementation for delegating clicks to Fragment to which adapter is attached. This gist is inspired from https://gist.github.com/aurae/ebf8ec212e4296aebb24 .
/**
* Created by Ishank Gulati on 14/10/16.
* Observer as per Observer design pattern.
*/
public interface RVObserver {
void update(RecyclerViewItemClickListener listener);
}
@DucHM
DucHM / set-dbeaver-timezone-to-UTC.txt
Created November 18, 2020 06:04 — forked from chetanppatil/set-dbeaver-timezone-to-UTC.md
Set dbeaver timezone to UTC (default timezone)
/* -------------- FOR LINUX USERS ---------------- */
1) Go to directory: "/usr/share/dbeaver"
2) Edit "dbeaver.ini" file
3) In that file add "-Duser.timezone=UTC" this line under "-vmargs" tag
4) Save it and restart dbeaver.
5) Enjoy with correct date without any date conversion.
Finally your dbeaver.ini file will look like this:
-startup
@DucHM
DucHM / set-dbeaver-timezone-to-UTC.txt
Created November 18, 2020 06:04 — forked from chetanppatil/set-dbeaver-timezone-to-UTC.md
Set dbeaver timezone to UTC (default timezone)
/* -------------- FOR LINUX USERS ---------------- */
1) Go to directory: "/usr/share/dbeaver"
2) Edit "dbeaver.ini" file
3) In that file add "-Duser.timezone=UTC" this line under "-vmargs" tag
4) Save it and restart dbeaver.
5) Enjoy with correct date without any date conversion.
Finally your dbeaver.ini file will look like this:
-startup
@DucHM
DucHM / set-dbeaver-timezone-to-UTC.txt
Created November 18, 2020 06:04 — forked from chetanppatil/set-dbeaver-timezone-to-UTC.md
Set dbeaver timezone to UTC (default timezone)
/* -------------- FOR LINUX USERS ---------------- */
1) Go to directory: "/usr/share/dbeaver"
2) Edit "dbeaver.ini" file
3) In that file add "-Duser.timezone=UTC" this line under "-vmargs" tag
4) Save it and restart dbeaver.
5) Enjoy with correct date without any date conversion.
Finally your dbeaver.ini file will look like this:
-startup
@DucHM
DucHM / MaintenanceListener.php
Created November 11, 2020 04:19 — forked from Koalabaerchen/MaintenanceListener.php
Maintenance Mode for Symfony
<?php
/**
* Based on http://www.wenigersh.com/blog/post/maintenance-mode-for-symfony-2-applications
*
* Includes support of user permisson check (here: check if user has role ADMIN), so admins can still surf the site while in maintenance mode
* Be aware that if you clear the cache (to start maintenance in prod environment) your sessions might be cleared as well, so people get logged out
* The config.yml will move the sessions to /app/sessions/[environment]
*
* Also be aware that you need at least Symfony 2.6 for this permission check. For older versions the call is different
* @see http://symfony.com/blog/new-in-symfony-2-6-security-component-improvements
@DucHM
DucHM / jQuery-file-exists.js
Created October 6, 2020 02:57 — forked from cmichi/jQuery-file-exists.js
Very simple way to check if a file exists, using jQuery.
/**
* Very simple way to check if a file exists on this domain.
* Use with the jQuery library.
*
* Important: Works only on the same domain.
* Cross-domain-requests have to be done in another way (see JSONP)!
*
* Use: console.log( "/data/list.json".fileExists() );
*/
String.prototype.fileExists = function() {
@DucHM
DucHM / ova-to-box.md
Created June 16, 2020 07:58 — forked from aondio/ova-to-box.md
Convert VirtualBox .ova to Vagrant box

Here's a step by step guide to convert a Virtualbox .ova to a Vagrant box.

  1. List your VMs to find the VM id you want to convert:
$ VBoxManage list vms
"testing" {a3f59eed-b9c5-4a5f-9977-187f8eb8c4d4}
  1. You can now package the .ova VM as Vagrant box:
@DucHM
DucHM / rm_mysql.md
Created May 4, 2020 04:14 — forked from vitorbritto/rm_mysql.md
Remove MySQL completely from Mac OSX

Remove MySQL completely

  1. Open the Terminal

  2. Use mysqldump to backup your databases

  3. Check for MySQL processes with: ps -ax | grep mysql

  4. Stop and kill any MySQL processes

  5. Analyze MySQL on HomeBrew:

brew remove mysql