Skip to content

Instantly share code, notes, and snippets.

View kudosqujo's full-sized avatar

qujo kudosqujo

View GitHub Profile
@sephraim
sephraim / outlook_folder_id.applescript
Created October 28, 2019 17:10
[Get folder ID in Microsoft Outlook for Mac]
-- 1.) Select folder in Outlook app
-- 2.) Open Script Editor
-- 3.) Paste the following into the editor and press play
tell application "Microsoft Outlook"
get selected folder
end tell
@sephraim
sephraim / rspec_diff.sh
Created October 3, 2019 19:43
[RSpec diff] Run RSpec on changed files only #rspec
git diff --name-only --diff-filter=d upstream/develop | grep '_spec.rb$' | xargs parallel_rspec -n 3
@sephraim
sephraim / rubodiff.sh
Last active November 19, 2021 18:41
[Rubocop diff] Run rubocop on changed files only
#!/bin/zsh
set -eu
# Run Rubocop on changed files only
git diff --name-only --diff-filter=d upstream/develop | xargs bundle exec rubocop --only-recognized-file-types "$@"
@sephraim
sephraim / NOTES
Last active August 18, 2020 23:25
[Test a Ruby module] #rspec
Related: https://www.rubydoc.info/gems/rubocop-rspec/1.6.0/RuboCop/Cop/RSpec/AnyInstance
@sephraim
sephraim / tracing.rb
Last active September 24, 2019 19:34
Tracing a Ruby app
# Ruby 1.9 using #set_trace_func
trace_log = '/application/log/trace.log'
File.write(trace_log, "#{'#'*150}\n"*5)
set_trace_func proc { |event, file, line, id, binding, classname|
unless file.include?('/usr/') || file.include?('/opt/')
LAST_FUNC ||= {}
unless LAST_FUNC[:id] == id && LAST_FUNC[:classname] = classname
file = file.sub('/application/', '')
file_line = "#{file}:#{line}"
string_format = "%-55s %20s %-60s\n"
@sephraim
sephraim / find_files_containing_AND_not_containing.sh
Last active September 24, 2019 19:40
Find files that contain one specific line but not another
# Find files that:
# 1.) are .rb files
# 2.) contain 'last_name'
# 3.) do NOT contain 'name_suffix'
# USING AG
ag -LG '.*\.rb' 'name_suffix' . | xargs ag 'last_name'
# USING GREP
find . -name "*.rb" -print | xargs grep -l 'last_name' | xargs grep -L 'name_suffix'
@sephraim
sephraim / doubles_stubs_spies_spec.rb
Last active September 15, 2023 13:21
RSpec examples #rspec
# Sample reference code for doubles/mocks, stubs, and spies in RSpec
# Taken from Kevin Skoglund's RSpec tutorial on Lynda.com
describe 'Doubles' do
it "allows stubbing methods" do
dbl = double("Chant")
allow(dbl).to receive(:hey!)
expect(dbl).to respond_to(:hey!)
end
@spaze
spaze / opera-vpn.md
Last active December 22, 2024 15:50
Opera VPN behind the curtains is just a proxy, here's how it works

2023 update

ℹ️ Please note this research is from 2016 when Opera has first added their browser "VPN", even before the "Chinese deal" was closed. They have since introduced some real VPN apps but this below is not about them.

🕵️ Some folks also like to use this article to show a proof that the Opera browser is a spyware or that Opera sells all your data to 3rd parties or something like that. This article here doesn't say anything like that.


When setting up (that's immediately when user enables it in settings) Opera VPN sends few API requests to https://api.surfeasy.com to obtain credentials and proxy IPs, see below, also see The Oprah Proxy.

The browser then talks to a proxy de0.opera-proxy.net (when VPN location is set to Germany), it's IP address can only be resolved from within Opera when VPN is on, it's 185.108.219.42 (or similar, see below). It's an HTTP/S proxy which requires auth.

// XPath CheatSheet
// To test XPath in your Chrome Debugger: $x('/html/body')
// http://www.jittuu.com/2012/2/14/Testing-XPath-In-Chrome/
// 0. XPath Examples.
// More: http://xpath.alephzarro.com/content/cheatsheet.html
'//hr[@class="edge" and position()=1]' // every first hr of 'edge' class
@natelandau
natelandau / .bash_profile
Last active March 1, 2025 11:46
Mac OSX Bash Profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management