Skip to content

Instantly share code, notes, and snippets.

@mclosson
mclosson / puma.service
Created March 10, 2018 21:43 — forked from arteezy/puma.service
Manage Puma with systemd on Ubuntu 16.04 and rbenv
[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
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();
require 'minitest/autorun'
class Strtime
def initialize(seconds)
@seconds = seconds
end
def to_s
raise ArgumentError if @seconds.to_i < 0
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);
# 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 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
@mclosson
mclosson / main.rs
Last active November 2, 2016 18:13
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;
/* 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;
}
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
/* 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