Skip to content

Instantly share code, notes, and snippets.

View djrobby's full-sized avatar

Robby Dhillon djrobby

  • Detroit, MI - USA
View GitHub Profile
@djrobby
djrobby / ua_regex.yml
Created April 10, 2021 11:48
Browser User Agent Regular Expressions (NSA)
user_agent_parsers:
#### SPECIAL CASES TOP ####
# CFNetwork Podcast catcher Applications
- regex: '(ESPN)[%20| ]+Radio/(\d+)\.(\d+)\.(\d+) CFNetwork'
- regex: '(Antenna)/(\d+) CFNetwork'
family_replacement: 'AntennaPod'
- regex: '(TopPodcasts)Pro/(\d+) CFNetwork'
- regex: '(MusicDownloader)Lite/(\d+)\.(\d+)\.(\d+) CFNetwork'
- regex: '^(.*)-iPad/(\d+)\.?(\d+)?.?(\d+)?.?(\d+)? CFNetwork'
@djrobby
djrobby / openssl_tls_1.2.patch
Created April 9, 2021 13:14 — forked from crftr/openssl_tls_1.2.patch
Source patch to add support to TLS 1.1 and 1.2 to Ruby 1.9.3
diff --git a/ext/openssl/ossl_ssl.c b/ext/openssl/ossl_ssl.c
--- a/ext/openssl/ossl_ssl.c
+++ b/ext/openssl/ossl_ssl.c
@@ -107,6 +107,18 @@
OSSL_SSL_METHOD_ENTRY(TLSv1),
OSSL_SSL_METHOD_ENTRY(TLSv1_server),
OSSL_SSL_METHOD_ENTRY(TLSv1_client),
+#if defined(HAVE_TLSV1_2_METHOD) && defined(HAVE_TLSV1_2_SERVER_METHOD) && \
+ defined(HAVE_TLSV1_2_CLIENT_METHOD)
+ OSSL_SSL_METHOD_ENTRY(TLSv1_2),
diff --git a/ext/openssl/extconf.rb b/ext/openssl/extconf.rb
index 8c04cb5..132d803 100644
--- a/ext/openssl/extconf.rb
+++ b/ext/openssl/extconf.rb
@@ -104,6 +104,9 @@
have_func("SSLv2_method")
have_func("SSLv2_server_method")
have_func("SSLv2_client_method")
+have_func("SSLv3_method")
+have_func("SSLv3_server_method")
@djrobby
djrobby / sqlite_to_json.sql
Created April 5, 2021 11:10 — forked from akehrer/sqlite_to_json.sql
SQLite Results as JSON using the SQLite JSON1 extension
-- When SQLite is compiled with the JSON1 extensions it provides builtin tools
-- for manipulating JSON data stored in the database.
-- This is a gist showing SQLite return query data as a JSON object.
-- https://www.sqlite.org/json1.html
-- An example table with some data
CREATE TABLE users (
id INTEGER PRIMARY KEY NOT NULL,
full_name TEXT NOT NULL,
email TEXT NOT NULL,
@djrobby
djrobby / sqlite_intro.sql
Created April 5, 2021 11:06 — forked from leondutoit/sqlite_intro.sql
sqlite things
-- this is a random comment
-- anything prefixed by two dashes is a comment
-- and will not be executed by the database
-- to start the interactive session on the command prompt
-- type: $ sqlite3
-- something will be printed and then you'll see another prompt like this
-- sqlite>
@djrobby
djrobby / icecast-kh
Last active March 25, 2021 10:45 — forked from ssamjh/icecast-kh
icecast-kh init.d Script (Ubuntu 20.04)
#!/bin/bash
### BEGIN INIT INFO
# Provides: icecast-kh
# Required-Start: $remote_fs $network
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts the icecast-kh audio streaming server daemon
### END INIT INFO
#
@djrobby
djrobby / credit_card.rb
Created December 24, 2020 20:55 — forked from Talha5/credit_card.rb
Ruby - Credit Card
class CreditCard
attr_accessor :card, :store
def initialize(card_identifier)
@card = card_identifier
@store = {
amex: {begins_with: ["34", "37"], number_length: ["15"]},
discover: {begins_with: ["6011"], number_length: ["16"]},
mastercard: {begins_with: ["51","52","53","54","55"], number_length: ["16"]},
visa: {begins_with: ["4"], number_length: ["13", "16"]},
@djrobby
djrobby / sequel_scopes.rb
Created December 18, 2020 14:34 — forked from odigity/sequel_scopes.rb
The Sequel Gem: Everything About Scopes
# (I recommend understanding the basics of this first: http://sequel.jeremyevans.net/rdoc/files/doc/object_model_rdoc.html)
# Extending the underlying dataset (http://sequel.jeremyevans.net/rdoc/files/README_rdoc.html#label-Extending+the+underlying+dataset)
# The recommended way to implement table-wide logic by defining methods on the dataset using dataset_module:
class Post < Sequel::Model
dataset_module do
def posts_with_few_comments
where{num_comments < 30}
@djrobby
djrobby / CombineClient.swift
Last active February 28, 2021 12:13 — forked from sarpsolakoglu/CombineClient.swift
A simple Swift 5.1 REST client that uses Combine
//
// CombineClient.swift
// CombineClient
//
// Created by Sarp Solakoglu on 14/11/2019.
// Copyright © 2019 Sarp Solakoglu. All rights reserved.
//
import Foundation
import Combine
import Combine
import Foundation
struct NamedURL: Codable {
let name: String
let url: URL
}
struct PokeAPIResponse: Codable {
let results: [NamedURL]