Skip to content

Instantly share code, notes, and snippets.

@SikhNerd
SikhNerd / google-cloud-memorystore-dump.md
Created May 8, 2019 20:18 — forked from basiszwo/google-cloud-memorystore-dump.md
Dump Redis rdb file from Google Cloud MemoryStore

Dumping a redis rdb file from a Google Cloud MemoryStore is easier than expected using redis-cli

Command

redis-cli -h <IP of MemoryStore Instance> --rdb dump.rdb
@SikhNerd
SikhNerd / migrate-redis.py
Last active October 1, 2019 08:47 — forked from maljolani/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.
# cat QR.go
package main;import("fmt";"strings");func main(){fmt.Print("print\x27"+strings.Replace("import Data.Char@nmain=putStrLn$@\"procedure main();write(@@@\"DO,1<-#@\"++show(length s)++f s 1 0;f(x:t)i c=let v=foldl(@@a x->a*2+(mod x 2))0$take 8$iterate(flip div 2)$Data.Char.ord x in(if mod i 4<1then@\"PLEASE@\"else@\"@\")++@\"DO,1SUB#@\"++show i++@\"<-#@\"++show(mod(c-v)256)++@\"@@@@n@\"++f t(i+1)v;f[]_ _=@\"PLEASEREADOUT,1@@@@nPLEASEGIVEUP@@@\");end@\";s=(@\".class public QR@@n.super java/lang/Object@@n.method public static main([Ljava/lang/String;)V@@n.limit stack 2@@ngetstatic java/lang/System/out Ljava/io/PrintStream;@@nldc @@@\"class QR{public static void main(String[]v){String c[]=new String[8000],y=@@@@@@@\"@@@@@@@\",z=y,s=@@@@@@@\"+q,T+n,J,O,U,F,S,O,B,M+L,D,P,O,T,U,B,i,;+d+j+e+g+d+L,Y+L,J+i,=,D+N,0,2+z,.,4+L,<+c+c,Q,S,h,U,<+f+t+T-C+t-;+c,n,M+k-G-G,O-G+4+q->-A,G-G+L+Q,T-W-N-D-N-<+Z,B,T,T,F,N,C,M,Z-W-B-D,a-G,c+Z,N,F,U,I,P,E-W,t,B,U,J,D-W,W,P,J-z-D+L,-,B,h-G-F-D+U-G,a+Z,F,i,S,Z,Q.2,i-W,M,E,t,S-a-H-
@SikhNerd
SikhNerd / quine-relay.log
Created July 15, 2013 23:36
Trying to run mame's quine-relay
# cat output.log
#####################
## Ruby -> Scala ##
#####################
ruby QR.rb > QR.scala
#######################
## Scala -> Scheme ##
@SikhNerd
SikhNerd / mongrel.rb
Created April 11, 2012 02:14
initializers/mongrel.rb
if ['2.3.8', '2.3.9', '2.3.10', '2.3.11','2.3.14'].include?(Rails.version) && Gem.available?('mongrel', '~>1.1.5') && self.class.const_defined?(:Mongrel)
# Pulled right from latest rack. Old looked like this in 1.1.0 version.
#
# def [](k)
# super(@names[k] ||= @names[k.downcase])
# end
#
module Rack
module Utils
#!/path/to/redmine/script/runner
Repository.all.each(&:"destroy!")
production:
delivery_method: :smtp
smtp_settings:
enable_starttls_auto: true
tls: true
address: smtp.gmail.com
port: 587
domain: smtp.gmail.com
authentication: :plain
user_name: [email protected]
<%= call_hook :view_account_login_top %>
<div id="login-form">
<% form_tag({:action=> "login"}) do %>
<%= back_url_hidden_field_tag %>
<table width="460">
<% if Setting.openid? %>
<script>
var
select_openid_url = '',
select_openid_provider = function( field_ns ){
RewriteEngine on
RewriteCond %{HTTP_HOST} ^sub.domain.tld$ [OR]
RewriteCond %{HTTP_HOST} ^www.sub.domain.tld$
RewriteRule ^(.*)$ "http\:\/\/127\.0\.0\.1\:12001%{REQUEST_URI}" [P,QSA,L]
<os:Image width="16" height="16">data:image/x-icon;base64,AAABAAEAEBAAAAEACABoBQAAFgAAACgAAAAQAAAAIAAAAAEACAAAAAAAAAEAABILAAASCwAAAAEAAAABAAAAB5oAAwqbAAcNnQAKEZ4ADBOfAA8OtAATGaEAERC1ABIRtQAcG7gAJSupACIhugAsK70ANjuvADg9sAAaG8AAGxzAACcoxAAoKcQAKivEAC82ygAwMcYANTTAADA3ygBHTLYAUVa6AFNYuwBWWrwAXWG/AEFHzwBFRswAREvPAEtLxwBNTs4AUFHPAFdWygBfX80AU1TQAGNizgBiZ9cAZGXUAGVq2ABoZ9AAbW3XAG902gB1eMgAdXrcAHl51QB7etYAfn7XAICDzQCHhtkAiIjeAIyN3wCOkdIAlJfVAJaZ1gCYm+UAnp7hAJ+f5QCipdsApqjcAKGh4AChoeUAp6rpAKmo5ACqquUArKznALK06wCztOoAtbjsALm55wC9v+UAurnpALu76gC9veoAwMLvAMbG7wDNz+sAzMzxAM3O8QDOzvIA0NHsANDQ8gDY2PMA29zxAN/f9gDk5PcA5uf1AOjo+QDt7vsA7u75AO/v+gDy8voA8/P6APPz/AD5+f0A+fr9APr6/QD6+v4A+/v+AP39/gD9/f8A/v7/AP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA