Skip to content

Instantly share code, notes, and snippets.

View rchasman's full-sized avatar
🥳

Roey D. Chasman rchasman

🥳
View GitHub Profile
@rchasman
rchasman / migrate-redis.py
Created August 3, 2019 00:24 — forked from metamatik/migrate-redis.py
Migrate Redis data on Amazon ElastiCache
"""
Forked and heavily adappted from:
https://gist.github.com/kitwalker12/517d99c3835975ad4d1718d28a63553e
Copies all keys from the source Redis host to the destination Redis host.
Useful to migrate Redis instances where commands like SLAVEOF and MIGRATE are
restricted (e.g. on Amazon ElastiCache).
The script scans through the keyspace of the given database number and uses
a pipeline of DUMP and RESTORE commands to migrate the keys.
+----------------------+--------+--------+---------+---------+-----+-------+
| Name | Lines | LOC | Classes | Methods | M/C | LOC/M |
+----------------------+--------+--------+---------+---------+-----+-------+
| Controllers | 2519 | 2192 | 42 | 188 | 4 | 9 |
| Jobs | 352 | 312 | 21 | 24 | 1 | 11 |
| Models | 18207 | 13750 | 181 | 1023 | 5 | 11 |
| Mailers | 500 | 447 | 14 | 31 | 2 | 12 |
| Channels | 33 | 33 | 7 | 5 | 0 | 4 |
| Libraries | 1847 | 1696 | 6 | 8 | 1 | 210 |
| Mailer specs | 51 | 36 | 4 | 0 | 0 | 0 |
[~/boost/boost-client]$ cloc --exclude-dir=node_modules . [master][ruby-2.6.2]
1428 text files.
1422 unique files.
28 files ignored.
github.com/AlDanial/cloc v 1.80 T=6.31 s (222.7 files/s, 132139.1 lines/s)
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
JavaScript 783 122609 54817 615652
{"page"=>{"body"=>{"type"=>"mailup-bee-page-properties", "content"=>{"style"=>{"color"=>"#000000", "font-family"=>"'Montserrat', 'Trebuchet MS', 'Lucida Grande', 'Lucida Sans Unicode', 'Lucida Sans', Tahoma, sans-serif"}, "computedStyle"=>{"linkColor"=>"#00AEAF", "messageWidth"=>"580px", "messageBackgroundColor"=>"transparent"}}, "webFonts"=>[], "container"=>{"style"=>{"background-color"=>"#FFFFFF"}}}, "rows"=>[{"type"=>"one-column-empty", "locked"=>false, "columns"=>[{"style"=>{"border-top"=>"0px solid transparent", "border-left"=>"0px solid transparent", "padding-top"=>"0px", "border-right"=>"0px solid transparent", "padding-left"=>"0px", "border-bottom"=>"0px solid transparent", "padding-right"=>"0px", "padding-bottom"=>"0px", "background-color"=>"transparent"}, "modules"=>[{"type"=>"mailup-bee-newsletter-modules-divider", "locked"=>false, "descriptor"=>{"style"=>{"padding-top"=>"10px", "padding-left"=>"0px", "padding-right"=>"0px", "padding-bottom"=>"10px"}, "divider"=>{"style"=>{"width"=>"100%", "height"
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional //EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:o=\"urn:schemas-microsoft-com:office:office\"><head>\n <!--[if gte mso 9]><xml>\n <o:OfficeDocumentSettings>\n <o:AllowPNG/>\n <o:PixelsPerInch>96</o:PixelsPerInch>\n </o:OfficeDocumentSettings>\n </xml><![endif]-->\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width\" />\n <!--[if !mso]><!--><meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" /><!--<![endif]-->\n <title>BF-simple-template</title>\n \n \n <style type=\"text/css\" id=\"media-query\">\n body {\n margin: 0;\n padding: 0; }\n\ntable, tr, td {\n vertical-align: top;\n border-collapse: collapse; }\n\n.ie-browser table, .mso-container table {\n table-layout: fixed; }\n\n* {\n line-height: inherit
class PracticePantherIntegrationService < IntegrationService
def oauth_klass
PracticePantherOauthService
end
def deauthorize!
@integration.destroy!
end
end
class ClioIntegrationService < IntegrationService
def oauth_klass
ClioOauthService
end
end
class IntegrationService
def initialize(integration)
@integration = integration
end
def token_expired?
Time.current > @integration.expires_at
end
def refresh_token!
@rchasman
rchasman / AWS.cls
Last active October 21, 2022 08:20 — forked from brianmfear/AWS.cls
Abstract AWS implementation in Apex Code
/*
// Example implementation as follows:
public class AWSS3_GetService extends AWS {
public override void init() {
endpoint = new Url('https://s3.amazonaws.com/');
resource = '/';
region = 'us-east-1';
service = 's3';
accessKey = 'my-key-here';
method = HttpMethod.XGET;
contract Ballot {
struct Voter {
uint weight;
bool voted;
uint8 vote;
address delegate;
}
struct Proposal {
uint voteCount;