Skip to content

Instantly share code, notes, and snippets.

@meyt
meyt / conky.conf
Last active July 17, 2022 22:24
Conky + Jalali Date
conky.config = {
update_interval = 1,
cpu_avg_samples = 2,
net_avg_samples = 2,
out_to_console = false,
override_utf8_locale = true,
double_buffer = true,
no_buffers = true,
text_buffer_size = 32768,
@meyt
meyt / config
Created October 21, 2018 08:20
Connect to git/ssh through TOR proxy
# Append into ~/.ssh/config
Host gitlab.com
User git
Hostname gitlab.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
ProxyCommand /bin/nc -x 127.0.0.1:9050 %h %p
@meyt
meyt / build-tld-list.js
Last active December 29, 2018 10:23
Extract TLD list JSON from IANA database
/**
* Requirements:
* - Node v10
* - punycode.js
*/
const request = require('request');
const punycode = require('punycode');
const tldDbUrl = 'https://data.iana.org/TLD/tlds-alpha-by-domain.txt';
@meyt
meyt / purge-restore.sh
Last active July 24, 2019 06:28
Resotre latest purged APT packages
#!/bin/bash
# from: https://serverfault.com/a/646116
sudo apt-get install `grep Purge /var/log/apt/history.log | tail -1 | sed -e 's|Purge: ||g' -e 's|([^)]*)||g' -e 's|:[^ ]* ||g' -e 's|,||g'`
@meyt
meyt / main.py
Last active February 10, 2019 14:39
Simple stupid file uploader with python3.6 and nanohttp>=1.10.4
from os import makedirs
from os.path import join, basename
from sys import argv
from nanohttp import (
RestController,
Static,
html,
context,
quickstart,
@meyt
meyt / v-the-mask.vue
Created March 6, 2019 12:09
vuetify + vue-the-mask component
<template>
<div :class="classes">
<label>{{ label }}</label>
<div class="input-group__input">
<span
v-if="prefix"
class="input-group--text-field__prefix"
v-text="prefix"
/>
<the-mask
@meyt
meyt / post-commit.sh
Created March 6, 2019 17:54
Git auto-tag hook by package.json (nodejs packages)
#! /bin/bash
# File: .git/hooks/post-commit
# source: https://coderwall.com/p/mk18zq/automatic-git-version-tagging-for-npm-modules
version=`git diff HEAD^..HEAD -- "$(git rev-parse --show-toplevel)"/package.json | grep '^\+.*version' | sed -s 's/[^0-9\.]//g'`
if [ "$version" != "" ]; then
git tag -a "v$version" -m "`git log -1 --format=%s`"
echo "Created a new tag, v$version"
fi
@meyt
meyt / nuxt-router-hack-plugin.js
Created March 14, 2019 07:00
Force refresh current route on vue-router
/*
Problem: When user click on a link that refers to current path,
nothing happen. in vue-router logic, same path must ignore.
Expected: As browsers UX on old-fashion websites, user expects
something happen when click on a link, like refresh the current
route.
Solution: We hack the vue-router push method
(thanks to vue-router clean code) to append a query-string
@meyt
meyt / numberingSystems.js
Created May 1, 2019 05:22
Numbering systems in JS
const numberingSystems = {
arab: '٠١٢٣٤٥٦٧٨٩',
arabext: '۰۱۲۳۴۵۶۷۸۹',
bali: '᭐᭑᭒᭓᭔᭕᭖᭗᭘᭙',
beng: '০১২৩৪৫৬৭৮৯',
deva: '०१२३४५६७८९',
fullwide: '0123456789',
gujr: '૦૧૨૩૪૫૬૭૮૯',
guru: '੦੧੨੩੪੫੬੭੮੯',
hanidec: '〇一二三四五六七八九',
@meyt
meyt / setup-postgres.sh
Last active May 9, 2019 17:41
Quick setup and configure postgres9.x on Ubuntu (development)
# How to run?
# sudo bash ./setup-postgres.sh
# Install
apt install -y postgresql;
# Set default password "postgres" for postgres user
sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'postgres';";
# Allow all type of connection with md5 authentication