Skip to content

Instantly share code, notes, and snippets.

@WestleyK
WestleyK / output-color.sh
Created August 15, 2018 01:19
printf color output
#!/bin/bash
#
# Created by: Westley K
# Date: Aug 14, 2018
#
# run this in your terminal, and
# you will get nice colors and effects!
#
@alex-bezverkhniy
alex-bezverkhniy / devops-skills-list.md
Last active October 18, 2018 20:19
Skils for DevOps

Skils list for DevOps

In this "gist" I am going to collect information related with DevOps

OpenShift


Docker

Get all docker processes

@bernardolopes8
bernardolopes8 / BookPersister.java
Last active November 15, 2024 13:04
Jersey Pagination, Sorting, and Filtering Example
package my.application.dao;
import java.util.List;
import my.application.entity.Book;
import my.application.restutil.RequestOptions;
public interface BookPersister {
List<Book> getBooks(RequestOptions requestOptions);
}
@gwpantazes
gwpantazes / How to Install JDK MacOS Homebrew.md
Last active June 30, 2025 07:13
How to install different JDK versions on MacOS with Homebrew

How To Install Different JDK Versions on MacOS with Homebrew

Keywords: Java, JDK (Java Development Kit), MacOS, Homebrew, Specific Version

This how-to guide covers how to install different versions of the JDK on MacOS with Homebrew.

Table of Contents

@himalay
himalay / git.sh
Last active October 23, 2022 22:58
[git]
### get all branch
git branch -a | grep -v HEAD | perl -ne 'chomp($_); s|^\*?\s*||; if (m|(.+)/(.+)| && not $d{$2}) {print qq(git branch --track $2 $1/$2\n)} else {$d{$_}=1}' | csh -xfs
#### GET URL FROM LOCAL REPO
git config --get remote.origin.url
#### change git remote url
git remote set-url origin https://github.com/USERNAME/OTHERREPOSITORY.git
git clone -b betav1 [email protected]:krishontreat/pain_diary.git
@chrisveness
chrisveness / crypto-aes-gcm.js
Last active May 11, 2025 11:17
Uses the SubtleCrypto interface of the Web Cryptography API to encrypt and decrypt text using AES-GCM (AES Galois counter mode).
/**
* Encrypts plaintext using AES-GCM with supplied password, for decryption with aesGcmDecrypt().
* (c) Chris Veness MIT Licence
*
* @param {String} plaintext - Plaintext to be encrypted.
* @param {String} password - Password to use to encrypt plaintext.
* @returns {String} Encrypted ciphertext.
*
* @example
* const ciphertext = await aesGcmEncrypt('my secret text', 'pw');
@afc163
afc163 / cascader-address-options.js
Last active August 24, 2024 15:24
Address options for antd cascader
import provinces from 'china-division/dist/provinces.json';
import cities from 'china-division/dist/cities.json';
import areas from 'china-division/dist/areas.json';
areas.forEach((area) => {
const matchCity = cities.filter(city => city.code === area.cityCode)[0];
if (matchCity) {
matchCity.children = matchCity.children || [];
matchCity.children.push({
label: area.name,
@Fleshgrinder
Fleshgrinder / ssmtp-debian-setup.md
Last active July 12, 2024 18:09
Set up sSMTP on Debian as replacement for sendmail and usage with PHP

sSMTP Debian Setup

The sendmail package, which comes preinstalled with many distros, is often simply too much for a simple server that should not receive emails but rather deliver them. The sSMTP package is a lightweight replacement that does not set up regular cronjobs and only reacts if a subsystem actually wants to send a mail.

Uninstall Sendmail

apt-get purge --yes sendmail*

Simple Chat Using PHP Socket + HTML5 WebSocket

HTML5's Websocket provides an important feature for establishing a socket connections between web browsers and servers. Once the connection has been established with the server, all the messages are sent directly over a socket rather than usual HTTP response and requests, giving us much faster and persistent communication between a web browser and a server. In this tutorial, let’s create a simple chat system using this technology.

Chat Server using PHP Socket: The Implementation

First, we need to create a Socket server that runs permanently, performs the handshaking, send/receive data from the chat page, and finally handles multiple clients. To this end, we will create a daemon script in PHP. I know what you might be thinking, PHP is mostly used to create dynamic webpages, BUT we can also create background daemons using nothing but PHP. How we do that? Well just follow this steps:

1. Install WebSocket Server

After finished with the Installation of a

@RyanABailey
RyanABailey / js
Created November 24, 2014 05:27
regex password
var password = "Mypassword01";
var regexString = "^((?=.{8,}$)(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*|(?=.{8,}$)(?=.*\d)(?=.*[a-zA-Z])(?=.*[!\u0022#$%&'()*+,./:;⇔?@[\]\^_`{|}~-]).*)";
var regexx = new RegExp(regexString);
if (!regexx.test(password)) {
// password did not match regex
}