Skip to content

Instantly share code, notes, and snippets.

View stdedos's full-sized avatar
💭
𝒪(𝑛) things to do, 𝒪(lg 𝑛) time to do them

Stavros Ntentos stdedos

💭
𝒪(𝑛) things to do, 𝒪(lg 𝑛) time to do them
  • Helsinki, Finland
View GitHub Profile
@stdedos
stdedos / Readme.md
Last active December 18, 2020 18:57 — forked from bashenk/get_android_service_call_numbers.sh
POSIX compliant and portable fork, with ability to set the desired android version to check with the parameter -v

Calling Android services from ADB shell Many android automation recipes contain references to the "service call" command:

# service
Usage: service [-h|-?]
    service list
    service check SERVICE
    service call SERVICE CODE [i32 INT | s16 STR] ...
Options:
@stdedos
stdedos / stack_trace.sh
Last active January 16, 2020 14:03 — forked from akostadinov/stack_trace.sh
Get stack trace in Bash shell script/program.
# LICENSE: MIT, wtfpl or whatever OSS license you like
function get_stack() {
local STACK=""
local i message="${1:-""}"
local stack_size=${#FUNCNAME[@]}
# to avoid noise we start with 1 to skip the get_stack function
for (( i=1; i<stack_size; i++ )); do
local func="${FUNCNAME[$i]}"
local linen="${BASH_LINENO[$(( i - 1 ))]}"
@stdedos
stdedos / README.md
Created September 13, 2019 09:08 — forked from Tom4t0/README.md
Enable LDAP over SSL (LDAPS) for Microsoft Active Directory servers.

Enable LDAP over SSL (LDAPS) for Microsoft Active Directory servers

By default Microsoft active directory servers will offer LDAP connections over unencrypted connections (boo!).

The steps below will create a new self signed certificate appropriate for use with and thus enabling LDAPS for an AD server. Of course the "self-signed" portion of this guide can be swapped out with a real vendor purchased certificate if required.

Steps have been tested successfully with Windows Server 2012R2, but should work with Windows Server 2008 without modification. Requires a working OpenSSL install (ideally Linux/OSX) and (obviously) a Windows Active Directory server.

@stdedos
stdedos / Debug Jupyter notebooks in Pycharm.md
Created June 11, 2019 13:56 — forked from mwouts/Debug Jupyter notebooks in Pycharm.md
2018-06 Debug Jupyter notebooks with PyCharm

Did you ever had to debug some large cell in a Jupyter notebook? In the below I share my experience on the subject. We'll review the classical methods for debugging notebooks, and finally I'll show how to set breakpoints in PyCharm for code being execute in a jupyter notebook, and benefit of the comfort of a real Python IDE for debugging.

Debug in the notebook

Before I actually describe what Pycharm can do, we quickly review the jupyter commands for debugging.

Catch exceptions

@stdedos
stdedos / self-path_unit-test.sh
Last active July 5, 2018 08:46 — forked from gvlx/unit.sh
Bash test: get the directory of a script
#!/bin/bash
# Following stackoverflow discussion, from https://gist.github.com/tvlooy/cbfbdb111a4ebad8b93e (rev8)
function test(){
local __MESSAGE__="$1"
local __RECEIVED__="$2"
local __EXPECTED__="$3"
if [ "${__RECEIVED__}" == "${__EXPECTED__}" ]; then
@stdedos
stdedos / safeutil.py
Created June 24, 2018 13:00 — forked from alexwlchan/safeutil.py
Non-destructive file copying/moving in Python
#!/usr/bin/env python
"""
This is a script designed to be "safe" drop-in replacements for the
shutil move() and copyfile() functions.
These functions are safe because they should never overwrite an
existing file. In particular, if you try to move/copy to dst and
there's already a file at dst, these functions will attempt to copy to
a slightly different (but free) filename, to avoid accidental data loss.