Skip to content

Instantly share code, notes, and snippets.


Mladen Đurić macmladen

View GitHub Profile
macmladen /
Created Aug 2, 2022
Connecting to SMTP SSL server in terminal to be sure that sending works.
### Connecting to SMTP over SSL on 465
openssl s_client -connect
# CONNECTED(00000006)
# depth=1 C = US, O = DigiCert Inc, OU =, CN = Thawte TLS RSA CA G1
# verify error:num=20:unable to get local issuer certificate
# verify return:0
# ---
# Certificate chain
# 0 s:/CN=*
macmladen /
Last active Jun 2, 2022
Use new ssh key encryption EdDSA (type ed25519). Everything on using SSH agent. Not a script to run but a reference list of useful sample commands.
# Generating new SSH key best practice
# RSA is most widely used, 4096 bits recommended!
# Ed25519 was introduced in OpenSSH 6.5 of January 2014
# Ref:
# Ref:
# List all your keys
for key in ~/.ssh/id_*; do ssh-keygen -l -f "${key}"; done | uniq
macmladen / drupal_radiokarantin_check_media.sql
Last active Jul 7, 2021
Drupal, Check which post reference which media
View drupal_radiokarantin_check_media.sql
SELECT nid, node_field_data.status, type, FROM_UNIXTIME(node_field_data.created) AS Created, title, field_soundcloud_target_id AS mid, name, field_media_oembed_video_value AS Link
FROM `node_field_data`
LEFT JOIN `node__field_soundcloud` on node_field_data.nid=node__field_soundcloud.entity_id
LEFT JOIN `media__field_media_oembed_video` on field_soundcloud_target_id=media__field_media_oembed_video.entity_id
LEFT JOIN `media_field_data` on field_soundcloud_target_id=mid
WHERE type='article' OR type='episode'
macmladen / wp_users_extended.sql
Last active Jun 22, 2021
WordPress select users and extended profile data which is stored in same column. Lookup hint
View wp_users_extended.sql
SELECT ID, user_email email, user_registered registered, user_status status,
(SELECT meta_value FROM `pltfrm_usermeta` WHERE meta_key='last_activity' AND user_id=u.ID ) as active,
(SELECT meta_value FROM `pltfrm_usermeta` WHERE meta_key='first_name' AND user_id=u.ID ) as Name,
(SELECT meta_value FROM `pltfrm_usermeta` WHERE meta_key='last_name' AND user_id=u.ID ) as Surname
FROM `pltfrm_users` u
macmladen / youtube_list_time.js
Last active Apr 23, 2021
When you are on YouTube playlist page and want to know how long will the list play. You can paste it in console and run to get time in hh:mm:ss.
View youtube_list_time.js
const all = [];
.querySelectorAll('ytd-playlist-video-renderer ytd-thumbnail-overlay-time-status-renderer')
.forEach(a => all.push(a.textContent.trim()));
let videosLength = 0;
all.forEach(a => {
const timeSplit = a.split(':');
videosLength += timeSplit[0]*60 + timeSplit[1]*1;
macmladen / redirect.js
Created Aug 19, 2019
JavaScriptp HTTP like redirect
View redirect.js
// similar behavior as an HTTP redirect
// window. object can be omitted
macmladen / OSX Secure Disk
Last active Jul 6, 2019 — forked from joeblau/OSX Secure Disk
Securely erase an external disk using dd on OSX
View OSX Secure Disk

Securely erase an external disk using dd on OSX

  1. Plug in your SD card, HDD, or other block device and then use the following command to see which /dev/diskN node it's located on:
diskutil list
  1. Unmount the disk where N is the number of the disk taken from the above command:
macmladen / remove-all-followers.js
Created Mar 11, 2016
Remove all Twitter followers.
View remove-all-followers.js
* Removes all followers on Twitter, usually added by profile breach.
* Usage: just copy code bellow (triple click on line & CTRL+C ) to the
* Developer console in browser, press ENTER and watch them being deleted.
setInterval(function(){t=$('.following').find('.follow-button');if(!t[0]){window.scrollTo(0,$(document).height());}else{console.log(t.attr('class')); t.trigger('click');}},100)
macmladen /
Created Nov 23, 2015
Build local environment for development
## Always, before performing any installation, make sure that system is up to date:
# Freshen information on versions of system software packages
sudo apt-get update
# Perform upgrade of packages
sudo apt-get upgrade
# Perform upgrade of system (kernel)
sudo apt-get dist-upgrade
## Getting to know system
macmladen /
Last active Sep 13, 2016
Linux and Mac interactive shell script loading

Order of script loading for interactive login shell

User can have multiple ways to login and different OSes, different shells have different approach. As I always search for same information, I decided to collect them here.


To understand what's going on here, you need to understand a little background information about how shells (bash in this case) are run.

  • When you open a terminal emulator (gnome-terminal for example), you are executing what is known as an interactive, non-login shell.
  • When you log into your machine from the command line, via ssh, or run a command such as su username, you are running an interactive login shell.