Skip to content

Instantly share code, notes, and snippets.

@iArnaud
iArnaud / mysql-docker.sh
Created July 26, 2021 08:16 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@BhanukaUOM
BhanukaUOM / logitech-m557.sh
Last active July 26, 2021 20:56
Ubuntu Logitech M557 Additional key Programming
sudo apt-get install -y xbindkeys xautomation x11-utils
xbindkeys --defaults > $HOME/.xbindkeysrc
echo "
# Back
\"xte 'keydown Alt_L' 'keydown Control_L' 'keydown Up' 'keyup Up' 'keyup Control_L' 'keyup Alt_L'\"
b:8
# Forward
@tyler-dot-earth
tyler-dot-earth / logid.cfg
Last active October 13, 2023 07:50
Logiops (Linux driver) configuration example for Logitech MX Master 3. Includes gestures, smartshift, DPI. Tested on logid v0.2.2-35-g1c209ed. File location: `/etc/logid.cfg`
// Logiops (Linux driver) configuration for Logitech MX Master 3.
// Includes gestures, smartshift, DPI.
// Tested on logid v0.2.2-35-g1c209ed.
// File location: /etc/logid.cfg
devices: ({
name: "Wireless Mouse MX Master 3";
smartshift: {
@bogdanRada
bogdanRada / customize-mx-master-ubuntu.md
Created April 17, 2020 09:01 — forked from vukhanhtruong/customize-mx-master-ubuntu.md
Custom keymap for Logitech MX Master 2S mouse on Ubuntu

First, install Solaar to see the battery level on the taskbar

sudo apt-get install solaar

To remap the keys, install

sudo apt-get install xbindkeys xautomation
@ano
ano / Zapier: Slack to Email
Last active February 18, 2022 12:35
Send slack messages to email
function display_name(text) {
/* Remove all quotes
Remove whitespace, brackets, and commas from the ends. */
return text.replace(/(^[\s,>]+)|"|([\s,<]+$)/g, '');
}
function get_email_adresses(addr_list) {
/* Regex source:
https://html.spec.whatwg.org/multipage/forms.html#valid-e-mail-address
*/
@animir
animir / brute-force-protection-by-username-and-ip-plus-username.js
Last active November 10, 2023 16:57
Node.js rate-limiter-flexible. Brute-force protection - Block source of requests by IP, Username+IP and Username.
const http = require('http');
const express = require('express');
const Redis = require('ioredis');
const { RateLimiterRedis } = require('rate-limiter-flexible');
const redisClient = new Redis({ enableOfflineQueue: false });
const maxWrongAttemptsByIPperDay = 100;
const maxConsecutiveFailsByUsernameAndIP = 10;
const maxWrongAttemptsByUsernamePerDay = 50;
@psyray
psyray / letsencrypt_2018.md
Created October 17, 2018 16:23 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

@iArnaud
iArnaud / bookmarklet.js
Created September 28, 2018 12:15
Simple JS Bookmarket to got to the download page of you-T-ubemonkey
javascript:void(
function(){
var u = 'https://www.you'+'tu'+'bemonkey.com'+ window.location.pathname + window.location.search;
window.location = u;
}()
);
import { put, call, select, fork, all } from 'redux-saga/effects'
import { delay } from 'redux-saga'
import TicketsActions from 'Redux/TicketsRedux'
import LotteryActions from 'Redux/LotteryRedux'
import { callContract, callERC20 } from 'Services/Eth'
import { selectCountOfDraws, selectDrawsPage, selectDrawsLoading } from 'Utils/Selectors'
import { prepareTicketNumbers } from 'Utils/Tickets'
import { splitTransactions } from 'Utils/Transactions'
import { CONTRACT_ADDRESS } from 'Constants/Eth'
@psyray
psyray / jailkit
Last active February 28, 2022 22:04
Jailkit for Debian Stretch (add PHP, Drush, Composer, NodeJS, NPM, Ruby, Gem, Compass)
[php]
comment = the php interpreter and libraries
executables = /usr/bin/php,/usr/bin/php5.6,/usr/bin/php7.0,/usr/bin/php7.1
directories = /usr/lib/php, /usr/share/php, /usr/share/php5, /etc/php, /usr/share/php-geshi, /usr/share/zoneinfo, /etc/snmp, /usr/share/snmp
includesections = env
[env]
comment = environment variables
executables = /usr/bin/env