# In your Gemfile
gem "localhost"
# Then, depending on your desired server
gem "falcon"
gem "puma"
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
#!/bin/sh | |
print_usage() { | |
echo "usage: compress_video <input_file>" | |
echo "supported formats: mp4, webm, mkv, mov, avi, flv" | |
} | |
get_extension() { | |
f="${1##*/}" | |
case "$f" in |
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 os | |
import fnmatch | |
def get_comment_prefix(filename): | |
extension_to_comment = { | |
'.asm': (';', ';'), | |
'.awk': ('#', '#'), | |
'.c': ('//', '//'), | |
'.clj': (';;', ';;'), | |
'.cpp': ('//', '//'), |
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 'fileutils' | |
# Loop through all .jpg and .png files in the current directory | |
Dir.glob("{*.jpg,*.png}").each do |img| | |
# Construct the output filename with .webp extension | |
output_filename = "#{File.basename(img, File.extname(img))}.webp" | |
# Execute ffmpeg command to convert the image | |
system("ffmpeg -i '#{img}' '#{output_filename}'") | |
end |
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
{ | |
"$schema": "https://lnav.org/schemas/format-v1.schema.json", | |
"caddy": { | |
"title": "Caddy Server", | |
"description": "Caddy Server JSON access logs format", | |
"url": [ | |
"https://caddyserver.com/docs/caddyfile/directives/log" | |
], | |
"json": true, | |
"timestamp-field": "ts", |
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
# Make sure to have prepared statements enabled. | |
# config/database.yml | |
# test: | |
# database: ... | |
# prepared_statements: true | |
# Add this to the top scope of test/test_helper.rb or spec/rails_helper.rb and | |
# run tests as usual. | |
queries = Hash.new(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
# syntax = docker/dockerfile:1 | |
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile | |
ARG RUBY_VERSION=3.2.2 | |
FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base | |
# Rails app lives here | |
WORKDIR /rails | |
# Set production environment |
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
# To display flash messages inside XHR responses, | |
# place this file in app/controllers/concerns/ | |
# then include it in ApplicationController | |
module RenderFlashNowForXhr | |
extend ActiveSupport::Concern | |
private | |
# Flash messages are not directly available for XHR requests |
This file has been truncated, but you can view the full file.
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
{ | |
"1594486665971892224": { | |
"id": 1594486665971892224, | |
"user_id": 16298441, | |
"user": null, | |
"created_at": 1668990219, | |
"text": "if you tell me The Mask is standing behind me i will turn around and try to look at it. Because my dumb ass thinks The Mask is real", | |
"source": "<a href=\"https://mobile.twitter.com\" rel=\"nofollow\">Twitter Web App</a>", | |
"retweet_count": 670, | |
"favorite_count": 7772, |
NewerOlder