I hereby claim:
- I am habetdin on github.
- I am habetdin (https://keybase.io/habetdin) on keybase.
- I have a public key ASAUpULtmlGW5I2nIOxtEm1Rl0Ha0WvgfkzK9SbMfYJljgo
To claim this, I am signing this object:
# don't put duplicate lines or lines starting with space in the history | |
HISTCONTROL=ignoreboth:erasedups | |
# append to the history file, don't overwrite it | |
shopt -s histappend | |
# don't execute expanded result immediately | |
shopt -s histverify | |
# https://unix.stackexchange.com/a/18443 |
#!/bin/bash | |
# https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit | |
color_code=() | |
color_text=() | |
for c in {0..255}; do | |
color_code+=($(tput setaf $c)) | |
color_text+=($(printf '%s=%i' "$(tput setaf $c | cat -v)" $c)) | |
done |
# from the comments of https://backreference.org/2011/11/17/remove-duplicates-but-keeping-only-the-last-occurrence/ | |
tac <src-file> | awk '!a[$0]++' | tac | tee <dst-file> |
I hereby claim:
To claim this, I am signing this object:
Memory | CPU | SSD | Transfer | Price | Sign Up Link |
---|---|---|---|---|---|
1 GB | 1 core | 25 GB | 1 TB | $5/mo. | Get 5 free months |
2 GB | 1 core | 50 GB | 2 TB | $10/mo. | Get 2 free months |
4 GB | 2 cores | 80 GB | 4 TB | $20/mo. | Get 1 free month |
# | |
# Extracts exceptions from log files. | |
# | |
import sys | |
import re | |
from collections import defaultdict | |
REGEX = re.compile("(^\tat |^Caused by: |^\t... \\d+ more)") | |
# Usually, all inner lines of a stack trace will be "at" or "Caused by" lines. |
# 1. Remove all containers including their volumes | |
docker rm -vf $(docker ps -a -q) | |
# 2. Remove all images | |
docker rmi -f $(docker images -a -q) | |
# (1) and (2) as an one-liner | |
export _DCKR=$(docker ps -a -q) && [ -n "$_DCKR" ] && docker rm -vf ${_DCKR[@]}; export _DCKR=$(docker images -a -q) && [ -n "$_DCKR" ] && docker rmi -f ${_DCKR[@]}; unset _DCKR |
# Based on https://unix.stackexchange.com/a/31955 | |
find . -maxdepth 1 -name '*.cpp' -type f -exec sed -i -e '$a\' {} \; |
#!/usr/bin/env python3 | |
import ipaddress | |
import sys | |
source = [] | |
result = [] | |
for line in sys.stdin.readlines(): | |
source.extend(ipaddress.ip_network(net) for net in line.split()) |
<?php | |
function normalizeNumerals($string) { | |
$numerals_ascii = range(0, 9); // Western Arabic | |
$numerals_arabic = ['٠', '١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩']; // Eastern Arabic | |
$numerals_bengali = ['০', '১', '২', '৩', '৪', '৫', '৬', '৭', '৮', '৯']; // Bengali | |
$numerals_devanagari = ['०', '१', '२', '३', '४', '५', '६', '७', '८', '९']; // Devanagari (Nagari) | |
$numerals_myanmar = ['၀', '၁', '၂', '၃', '၄', '၅', '၆', '၇', '၈', '၉']; // Myanmar (Burmese) | |
$numerals_persian = ['۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹']; // Persian | |
$string = str_replace($numerals_arabic, $numerals_ascii, $string); |