Skip to content

Instantly share code, notes, and snippets.

View floer32's full-sized avatar

Michael Floering floer32

  • 20:09 (UTC -07:00)
View GitHub Profile
@floer32
floer32 / Alfred Workflows — where to find (or add) a script.md
Last active March 8, 2021 19:02
Where to find helper script files, etc, for Alfred Workflows. (alfredapp.com)

ℹ️ There's also an Alfred Workflow for searching and grabbing this directory.

  • Manage Alfred Extension - List and view details about installed Alfred extensions. Additional features added: Open in iTerm, Copy Path and Browse Data Directory.

Directory with all Alfred Workflows:

cd /Applications/AlfredSync/Alfred.alfredpreferences/workflows
@floer32
floer32 / RubyMine - project SDK problem (using asdf).md
Last active March 8, 2021 04:12
How to fix Rubymine having issues finding your Ruby SDK. I hit this when switching from rbenv to asdf.

problem:

Error configuring SDK: [...]. 
Please make sure that [... ruby path, from asdf or otherwise ...] is a valid home path for this SDK type.

solution that worked for me:

  1. close RubyMine
@floer32
floer32 / master.vim
Last active February 9, 2021 17:45 — forked from gmccreight/master.vim
Shortened fork of master.vim, which is "a script that gives you a playground for mastering vim." I learned via vim-adventures.com originally (highly recommend!) but this was good too. I removed sections I don't use, because I use vim keybindings inside other editors (and prefer the editors' functionality for anything "fancy")
" copy all this into a vim buffer, save it, then...
" source the file by typing :so %
" Now the vim buffer acts like a specialized application for mastering vim
" There are two queues, Study and Known. Depending how confident you feel
" about the item you are currently learning, you can move it down several
" positions, all the way to the end of the Study queue, or to the Known
" queue.
" type ,, (that's comma comma)
@floer32
floer32 / absolute_path_to_script_directory.sh
Created December 7, 2020 23:24
bash/zsh script - how to get absolute path to itself
export HERE="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
# example usage - source a script in same directory. but using absolute path,
# ... which you'd do so that a script can be called from wherever. (not dependent on working directory ($PWD))
. "${HERE}/common.sh"
# ... or of course you could export DIRNAME or whatever you want.
# In scripts I just find "$HERE/node_modules", "$HERE/src" etc to be pretty readable.
When life gives you lemons, make hummus
@floer32
floer32 / owasp-risk-rating.html
Created September 20, 2017 15:13 — forked from ErosLever/owasp-risk-rating.html
This is a quick and dirty OWASP Risk Rating Calculator. (demo: https://tinyurl.com/OwaspCalc )
<!-- access this at: https://cdn.rawgit.com/ErosLever/f72bc0750af4d2e75c3a/raw/owasp-risk-rating.html -->
<html><head>
<style>
#main{
width: 1200px;
}
table {
width: 98%;
font-size: small;
text-align: center;
@floer32
floer32 / centos_cx_Oracle
Last active January 6, 2020 23:29
CentOS 6: Set up Oracle Instant Client and Python package cx_Oracle
#!/bin/bash
# INSTALL ORACLE INSTANT CLIENT #
#################################
# NOTE: Oracle requires at least 1176 MB of swap (or something around there).
# If you are using CentOS in a VMWare VM, there's a good chance that you don't have enough by default.
# If this describes you and you need to add more swap, see the
# "Adding a Swap File to a CentOS System" section, here:
# http://www.techotopia.com/index.php/Adding_and_Managing_CentOS_Swap_Space
@floer32
floer32 / quick_punycode_encode_decode_example.py
Last active December 24, 2019 15:30
[Regarding Python 2 - in Python 3 just use normal strings that are always Unicode.] // quick example of encoding and decoding a international domain name in Python (from Unicode to Punycode or IDNA codecs and back). Pay attention to the Unicode versus byte strings
# INCORRECT! DON'T DO THIS!
>>> x = "www.alliancefrançaise.nu" # This is the problematic line. Forgot to make this a Unicode string.
>>> print x
www.alliancefrançaise.nu
>>> x.encode('punycode')
'www.Alliancefranaise.nu-h1a31e'
>>> x.encode('punycode').decode('punycode')
u'www.Alliancefran\xc3\xa7aise.nu'
>>> print x.encode('punycode').decode('punycode')
www.alliancefrançaise.nu
@floer32
floer32 / _socket_toggle.py
Last active December 18, 2019 20:31
Disable the internet in Python. With py.test hooks. (Disable socket.socket.) GREAT for unit testing.
from __future__ import print_function
import socket
import sys
_module = sys.modules[__name__]
def disable_socket():
""" disable socket.socket to disable the Internet. useful in testing.
.. doctest::

Aligning images

left alignment

This is the code you need to align images to the left: