Skip to content

Instantly share code, notes, and snippets.

View FrancisMurillo's full-sized avatar

Francis Murillo FrancisMurillo

View GitHub Profile
(with-eval-after-load 'projectile
(defconst fn/project-file ".project.el"
"Project configuration file")
(defconst fn/project-local-file ".project-locals.el"
"Project local setting file")
(defconst fn/project-init-files (list fn/project-file fn/project-local-file)
"Project init files")
@FrancisMurillo
FrancisMurillo / 2017-01-11 - w3m-vlc.el
Created January 10, 2017 14:18
2017-01-11 - w3m with vlc
(defcustom fn/w3m-video-executable "vlc"
"The executable that can run a network video stream.")
(defcustom fn/w3m-video-args
(list
;; This skews how the process is managed for vlc
;; "--one-instance"
;; "--play-and-exit"
)
"Extra arguments to run `fn/w3m-video-executable'")
@FrancisMurillo
FrancisMurillo / lib.rs
Created May 26, 2020 05:36
Peterson/Filter Lock
#[macro_use]
extern crate log;
use std::{
cell::{RefCell, UnsafeCell},
sync::atomic::{AtomicU8, Ordering},
};
thread_local! {
static THREAD_ID: RefCell<u8> = RefCell::new(0);
}
@FrancisMurillo
FrancisMurillo / lib.rs
Created August 8, 2020 06:06
Rust Median of Medians
#[cfg(test)]
#[macro_use(quickcheck)]
extern crate quickcheck_macros;
pub fn median<I: Ord + std::fmt::Debug>(items: &mut Vec<I>, index: usize) -> I {
assert!(index < items.len());
items.sort_unstable();
items.remove(index)
use std::fs;
use std::ops::{Deref, DerefMut};
#[derive(Debug)]
struct DB;
#[derive(Debug)]
struct Index(Vec<u8>);
#[derive(Debug)]
@FrancisMurillo
FrancisMurillo / browsing-w3m-anonymously-tor.el
Last active January 19, 2021 11:29
Browsing w3m Anonymously With tor
(with-eval-after-load 'w3m
(require 'cl nil t)
(require 'cl-compat nil t)
(when (and (executable-find "polipo")
(executable-find "tor"))
(defcustom fn/w3m-polipo-cache-dir (expand-file-name "polipo-cache" user-emacs-directory)
"Polipo cache directory."
:type 'directory)
(defcustom fn/w3m-tor-cache-dir (expand-file-name "tor-cache" user-emacs-directory)
@FrancisMurillo
FrancisMurillo / meow.el
Created January 12, 2017 07:38
Literate Org Haskell
(defconst fn/haskell-file-extension ".hs"
"The de facto haskell file extension.")
(defun fn/add-haskell-file-extension (name)
"Add the extension of .hs to a file or buffer NAME."
(if (string/ends-with name fn/haskell-file-extension)
name (concat name fn/haskell-file-extension)))
(defvar fn/org-haskell-mode-hook nil
"Hook when buffer is haskellized.")
@FrancisMurillo
FrancisMurillo / prodigy-depends-on.el
Created February 20, 2017 07:23
Prodigy.el :depends-on feature hack
(defvar prodigy-dependency-services nil
"An alist of the service name and some properties that aid in
managing service dependency.")
(defvar prodigy-dependency-service-status-change-hook nil
"A hook for listening in service status changes.")
(defconst prodigy-dependency-condition-prefix "prodigy-dependency-condition"
"A symbol prefix for easier debugging.")
@FrancisMurillo
FrancisMurillo / data.jsonl
Created January 17, 2023 11:26
Sample Meilisearch v3 dump
{"uuid":"2b441316-6ecd-4cb5-b6ed-43f94dbe1c12","update":{"status":"enqueued","updateId":5,"meta":"ClearDocuments","enqueuedAt":"2023-01-17T09:04:42.802887774Z"}}
{"uuid":"dcf86d48-0ebf-4a43-95e6-4ab43af30266","update":{"status":"enqueued","updateId":9,"meta":"ClearDocuments","enqueuedAt":"2023-01-17T09:04:44.131021383Z"}}
{"uuid":"2b441316-6ecd-4cb5-b6ed-43f94dbe1c12","update":{"status":"enqueued","updateId":6,"meta":"ClearDocuments","enqueuedAt":"2023-01-17T09:04:44.885871244Z"}}
{"uuid":"2b441316-6ecd-4cb5-b6ed-43f94dbe1c12","update":{"status":"enqueued","updateId":7,"meta":{"DocumentAddition":{"primary_key":null,"method":"ReplaceDocuments","content_uuid":"f29774f0-2951-427a-9e8f-87dc33485dc2"}},"enqueuedAt":"2023-01-17T09:04:52.141635220Z"}}
{"uuid":"75fd9fdd-b2ba-49ca-8e3e-83e6259dce0c","update":{"status":"enqueued","updateId":10,"meta":{"DocumentAddition":{"primary_key":null,"method":"ReplaceDocuments","content_uuid":"ebdc24a9-fe4d-4bed-a3ee-54de2717357f"}},"enqueuedAt":"2023-01-17T09:04:52.455155266Z"}}
@FrancisMurillo
FrancisMurillo / r2d2_test_connect.rs
Created February 8, 2023 13:54
Carabao Dev - Start transaction on r2d2 connection checkout
use diesel::{
pg::PgConnection,
r2d2::{ConnectionManager, Error as DieselPoolError},
result::ConnectionError,
};
use r2d2::{CustomizeConnection, Pool};
#[derive(Debug)]
struct TestConnection;