This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This started out as an exploration on decoding Rails session cookies in Rust. | |
// After reaching the "it works" stage I found: | |
// | |
// https://github.com/mikeycgto/message_verifier/ by @mikeycgto | |
// and you should really use that as its a much more elegant solution | |
// and also implements verifying the message as well as decrypting it | |
// which would be critical in actual use. | |
// | |
// https://gist.github.com/profh/e36e5dd0bec124fef04c | |
// https://gist.github.com/JoshCheek/7b1c1eb231dfa83098be |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# May 2017 Google SERP (Search Engine Result Page) extraction tool | |
# Written and tested with Ruby 2.4 but likely works with any Ruby 2.0 or above | |
# | |
# Usage: | |
# | |
# Customize these settings to your liking: | |
# user_agent: the browser user_agent string to be sent with each request | |
# total_pages: total number of pages requested (10 results per page) | |
# query: the search query to run | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
fn output<F: Fn(String)>(text: &str, strategy: F) { | |
let string = String::from(text); | |
strategy(string) | |
} | |
// define strategies as closures | |
let bold = |s| println!("<strong>{}</strong>", s); | |
let italics = |s| println!("<em>{}</em>", s); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'minitest/autorun' | |
class Strtime | |
def initialize(seconds) | |
@seconds = seconds | |
end | |
def to_s | |
raise ArgumentError if @seconds.to_i < 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::io::*; | |
fn main() { | |
loop{ | |
let mut l = String::new(); | |
let mut a = 0; | |
print!(">> "); | |
stdout().flush().unwrap(); | |
stdin().read_line(&mut l).unwrap(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Puma Rails Server | |
After=network.target | |
[Service] | |
Type=simple | |
User=deploy | |
WorkingDirectory=/home/deploy/app/current | |
ExecStart=/home/deploy/.rbenv/bin/rbenv exec bundle exec puma -C /home/deploy/app/shared/config/puma.rb | |
ExecStop=/home/deploy/.rbenv/bin/rbenv exec bundle exec pumactl -S /home/deploy/app/shared/tmp/pids/puma.state stop |
OlderNewer