Skip to content

Instantly share code, notes, and snippets.

@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*
@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,
@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');
@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
@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

@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);
}
@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

@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!
#
@syntaxlexx
syntaxlexx / bootstrap.js
Created October 28, 2018 18:54
Laravel/Vue.js - Guard against user inactivity [token expiry] by automatically refreshing the page after an hour.
window._ = require('lodash');
window.Popper = require('popper.js').default;
/**
* We'll load jQuery and the Bootstrap jQuery plugin which provides support
* for JavaScript based Bootstrap features such as modals and tabs. This
* code may be modified to fit the specific needs of your application.
*/
try {
@zenril
zenril / deploy
Created March 4, 2019 04:50
deploy
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )";
NAME="thing"
NODE_BIN_DIR=$(nvm which node | sed 's/\([/][^/]*\)\{1\}$//g')
NODE_PATH="$(nvm which node | sed 's/\([/][^/]*\)\{2\}$//g')/lib/node_modules"
SOURCEDIR="$DIR/app"
APPLICATION_PATH="$SOURCEDIR/bot.js"