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
server { | |
listen 80; | |
server_name example.com; | |
root /home/deploy/apps/example.com/public; | |
index index.html index.php; | |
client_max_body_size 1G; | |
fastcgi_buffers 64 4K; | |
location / { |
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
## | |
# Will keep all passed in attributes in the `attributes` attribute | |
# But will allow you to pull out certain attributes that you want as | |
# getters and setters. Great for accessing with `random_object.some` | |
# | |
class RandomObject | |
WANTED_ATTRS = [:some, :attrs, :you, :want] | |
attr_accessor :attributes, *WANTED_ATTRS |
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
--- | |
- hosts: all | |
sudo: yes | |
tasks: | |
- name: "test for swap partition" | |
shell: 'sudo swapon -s | grep -E "^/"' | |
register: swapfile | |
ignore_errors: yes |
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
#!/usr/bin/env bash | |
# Use `~/Downloads` to store incomplete downloads | |
defaults write org.m0k.transmission UseIncompleteDownloadFolder -bool true | |
defaults write org.m0k.transmission IncompleteDownloadFolder -string "${HOME}/Downloads" | |
# Do not prompt for confirmation before downloading | |
defaults write org.m0k.transmission DownloadAsk -bool false | |
# Trash original torrent files |
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
import mailbox | |
# Open the mbox files (relative to your present working directory) | |
# Note, Mail.app actually exports a mbox folder that contains an mbox file | |
mbox1 = mailbox.mbox('Old-Archive.mbox/mbox') | |
mbox2 = mailbox.mbox('New-Archive.mbox/mbox') | |
# Use something like `subject` to unique the messages | |
# or they will all be unique. | |
def subjects(mbox): |
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 'base64' | |
require 'open-uri' | |
require 'net/http' | |
require 'net/https' | |
require 'json' | |
class OCR | |
attr_reader :api_key, :image_url | |
def self.scan(api_key:, image_url:) |
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
# Call scopes directly from your URL params: | |
# | |
# @products = Product.filter(params.slice(:status, :location, :starts_with)) | |
module Filterable | |
extend ActiveSupport::Concern | |
module ClassMethods | |
# Call the class methods with the same name as the keys in <tt>filtering_params</tt> | |
# with their associated values. Most useful for calling named scopes from |
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
using CRMProject.Domain; | |
using Microsoft.EntityFrameworkCore; | |
using Microsoft.EntityFrameworkCore.ChangeTracking; | |
using System; | |
namespace Infrastructure.Data | |
{ | |
public class AppDbContext : DbContext | |
{ | |
public DbSet<Contact> Contacts { get; set; } |
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
using Renci.SshNet; | |
using SendGrid; | |
using SendGrid.Helpers.Mail; | |
using System; | |
using System.IO; | |
using System.Linq; | |
namespace PlayBall | |
{ | |
internal class Program |
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
# /etc/nginx/snippets/letsencrypt.conf | |
location ^~ /.well-known/acme-challenge/ { | |
default_type "text/plain"; | |
root /srv/www/letsencrypt; | |
} | |
# Hide /acme-challenge subdirectory and return 404 on all requests. | |
location = /.well-known/acme-challenge/ { | |
return 404; |
OlderNewer