This file contains 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 |
This file contains 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 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 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 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 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 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
extern crate hyper; | |
extern crate time; | |
use hyper::Url; | |
use hyper::client::*; | |
use std::fs::File; | |
use std::io::BufRead; | |
use std::io::BufReader; | |
use std::sync::{Arc, Mutex}; | |
use std::thread; |
This file contains 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
/* Problem */ | |
class Thing { | |
// testing this will result in expensive calls to event logs and database | |
public int dostuff() { | |
int result = something(); | |
EventLogsAndDatabaseLogger.log(1, 2, 3, 4, 5, "message"); | |
return result; | |
} |
This file contains 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
Cape South Mobile Home Park | |
West Melbourne | |
Mintons Corner | |
June Park | |
Melbourne Village | |
Quail Run Mobile Home Estates | |
The Lakes of Melbourne Mobile Home Park | |
Lakes of Melbourne Mobile Home Park | |
Melbourne Gardens | |
Trailer Haven Mobile Home Park |
This file contains 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
/* The following program is an example of a setup program which generates a | |
* secret key and writes it to a file which is only readably by the owner of | |
* the file. | |
* | |
* In this example the program should be made owned by root and the wheel group | |
* and the suid (set user ID) permission should be set so that when a regular | |
* user runs the program, the secrets.txt file will be created and owned by the | |
* root user. | |
* | |
* Your goal is to try to find a way without modifying the code of the program |
NewerOlder