- Open Automator
- Create a new document
- Select Quick Action
- Set “Service receives selected” to
files or foldersinany application - Add a
Run Shell Scriptaction- your default shell should already be selected, otherwise use
/bin/zshfor macOS 10.15 (”Catalina”) or later - older versions of macOS use
/bin/bash
- your default shell should already be selected, otherwise use
- if you're using something else, you probably know what to do 😉
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Url: https://gist.github.com/wassname/1393c4a57cfcbf03641dbc31886123b8 | |
| """ | |
| import unicodedata | |
| import string | |
| valid_filename_chars = "-_.() %s%s" % (string.ascii_letters, string.digits) | |
| char_limit = 255 | |
| def clean_filename(filename, whitelist=valid_filename_chars, replace=' '): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #add the repositories | |
| sudo apt-get update && sudo apt-get install -y curl | |
| curl http://files.freeswitch.org/repo/deb/debian/freeswitch_archive_g0.pub | sudo apt-key add - | |
| echo "deb http://files.freeswitch.org/repo/deb/freeswitch-1.6/ jessie main" | sudo tee /etc/apt/sources.list.d/freeswitch.list | |
| sudo apt-get update | |
| # install dependencies | |
| sudo apt-get install -y yasm nasm libyuv-dev libvpx2-dev liblua5.2-dev libvpx2-dev libvpx2 zlib1g-dev libspeex1 libopus-dev libsndfile-dev autoconf automake devscripts gawk g++ git-core 'libjpeg-dev|libjpeg62-turbo-dev' libncurses5-dev 'libtool-bin|libtool' make python-dev gawk pkg-config libtiff5-dev libperl-dev libgdbm-dev libdb-dev gettext libssl-dev libcurl4-openssl-dev libpcre3-dev libspeex-dev libspeexdsp-dev libsqlite3-dev libedit-dev libldns-dev libpq-dev yasm nasm unixodbc-dev unixodbc-bin unixodbc odbc-postgresql |
Moved to git repository: https://github.com/denji/golang-tls
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048
# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # extracted from http//www.naturalearthdata.com/download/110m/cultural/ne_110m_admin_0_countries.zip | |
| # under public domain terms | |
| country_bounding_boxes = { | |
| 'AF': ('Afghanistan', (60.5284298033, 29.318572496, 75.1580277851, 38.4862816432)), | |
| 'AO': ('Angola', (11.6400960629, -17.9306364885, 24.0799052263, -4.43802336998)), | |
| 'AL': ('Albania', (19.3044861183, 39.624997667, 21.0200403175, 42.6882473822)), | |
| 'AE': ('United Arab Emirates', (51.5795186705, 22.4969475367, 56.3968473651, 26.055464179)), | |
| 'AR': ('Argentina', (-73.4154357571, -55.25, -53.628348965, -21.8323104794)), | |
| 'AM': ('Armenia', (43.5827458026, 38.7412014837, 46.5057198423, 41.2481285671)), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| function main() | |
| { | |
| monitor_from_file $* | |
| } | |
| function monitor_vpn_ip_port() | |
| { | |
| local CONN_NAME=$1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """Add user created_by and modified_by foreign key refs to any model automatically. | |
| Almost entirely taken from https://github.com/Atomidata/django-audit-log/blob/master/audit_log/middleware.py""" | |
| from django.db.models import signals | |
| from django.utils.functional import curry | |
| class WhodidMiddleware(object): | |
| def process_request(self, request): | |
| if not request.method in ('GET', 'HEAD', 'OPTIONS', 'TRACE'): | |
| if hasattr(request, 'user') and request.user.is_authenticated(): | |
| user = request.user |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| from multiprocessing import Process, Pool | |
| import time | |
| import urllib2 | |
| def millis(): | |
| return int(round(time.time() * 1000)) | |
| def http_get(url): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ########################################################## | |
| # django postgres polling - LISTEN | |
| import psycopg2.extensions | |
| import select | |
| from django.db import connection | |
| crs = connection.cursor() # get the cursor and establish the connection.connection | |
| pg_con = connection.connection |
NewerOlder