Skip to content

Instantly share code, notes, and snippets.

View kudosqujo's full-sized avatar

qujo kudosqujo

View GitHub Profile
@btoone
btoone / curl.md
Last active July 10, 2025 04:38
A curl tutorial using GitHub's API

Introduction

An introduction to curl using GitHub's API.

The Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin
@pkuczynski
pkuczynski / LICENSE
Last active May 21, 2025 12:54
Read YAML file from Bash script
MIT License
Copyright (c) 2014 Piotr Kuczynski
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWAR
@natelandau
natelandau / .bash_profile
Last active June 23, 2025 21:53
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
// 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
@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.

@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
@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 / 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 / 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 / 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 "$@"