Skip to content

Instantly share code, notes, and snippets.

@kepano
kepano / obsidian-web-clipper.js
Last active May 22, 2024 10:51
Obsidian Web Clipper Bookmarklet to save articles and pages from the web (for Safari, Chrome, Firefox, and mobile browsers)
javascript: Promise.all([import('https://unpkg.com/turndown@6.0.0?module'), import('https://unpkg.com/@tehshrike/readability@0.2.0'), ]).then(async ([{
default: Turndown
}, {
default: Readability
}]) => {
/* Optional vault name */
const vault = "";
/* Optional folder name such as "Clippings/" */
@tekin
tekin / .gitattributes
Last active February 23, 2024 16:46
An example .gitattributes file that will configure custom hunk header patterns for some common languages and file formats. See https://tekin.co.uk/2020/10/better-git-diff-output-for-ruby-python-elixir-and-more for more details.
# Stick this in your home directory and point your Global Git config at it by running:
#
# $ git config --global core.attributesfile ~/.gitattributes
#
# See https://tekin.co.uk/2020/10/better-git-diff-output-for-ruby-python-elixir-and-more for more details
*.c diff=cpp
*.h diff=cpp
*.c++ diff=cpp
*.h++ diff=cpp
namespace :solargraph do
task generate: :environment do
# Add the folder you choose in your config/application.rb
# example:
# config.autoload_paths << Rails.root.join('app/solargraph')
gen_directory = Rails.root.join("config", "yard")
# run the script as a rails runner:
# jundle exec rails r ./bin/generate_solar_models.rb
import SwiftUI
import Combine
struct HMS {
var h: Int
var m: Int
var s: Int
}
struct ContentView: View {
@nateberkopec
nateberkopec / tf-dev-script.sh
Last active June 3, 2020 09:13
tf-dev-script.sh
#!/bin/bash
# Assumes you have a DIGITALOCEAN_TOKEN env var pre-set
# Assumes you have terraform and mutagen installed
# Assumes DO has an SSH key uploaded
DO_REGION="sgp1" # Set to DO region: https://www.digitalocean.com/docs/platform/availability-matrix/
SSH_KEY_FINGERPRINT="your-key-fingerprint" # You can find this in your control panel
if [ -z $DIGITALOCEAN_TOKEN ]; then
exit 1
{
"name": "rsms dark v2 mono",
"author": "rsms",
"variables": {
"red": "hsl(5, 0%, 50%)",
"orange": "hsl(27, 0%, 50%)",
"yellow": "hsl(60, 0%, 50%)",
"green": "hsl(150, 0%, 43%)",
"cyan": "hsl(180, 0%, 50%)",
"blue": "hsl(210, 0%, 50%)",
@castwide
castwide / rails.rb
Last active April 27, 2024 08:54
Enhance Rails Intellisense in Solargraph
# The following comments fill some of the gaps in Solargraph's understanding of
# Rails apps. Since they're all in YARD, they get mapped in Solargraph but
# ignored at runtime.
#
# You can put this file anywhere in the project, as long as it gets included in
# the workspace maps. It's recommended that you keep it in a standalone file
# instead of pasting it into an existing one.
#
# @!parse
# class ActionController::Base
@rempargo
rempargo / nginx_parser_log.rb
Created November 6, 2018 20:40 — forked from fidelisrafael/nginx_parser_log.rb
Nginx Logger Parser for Ruby
require 'pry'
require 'json'
require 'uri'
module Application
class NginxLogParser
DEFAULT_FORMAT_REGEXP = /(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\s?\-\s?-\s?\[(\d{2}\/[a-z]{3}\/\d{4}:\d{2}:\d{2}:\d{2} (\+|\-)\d{4})\]\s?\\?"?(GET|POST|PUT|HEAD|DELETE|OPTIONS)\s?(.*?)\s(HTTP\/\d\.\d)\\?"?\s?(\d{3})\s?(\d+)\s?\\?\"\-\\?\"\s?\\?\"(.*?)\"/i
REQUEST_FORMAT = [
@fnky
fnky / ANSI.md
Last active May 24, 2024 04:41
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27

Fixing macOS 10.14, 10.15, 12

Dark main menu without the rest of dark mode

  1. Set Light mode
  2. defaults write -g NSRequiresAquaSystemAppearance -bool Yes
  3. Log out and log back in
  4. Set Dark mode