Skip to content

Instantly share code, notes, and snippets.

View jgarte's full-sized avatar
🎯
Focusing

Jorge Gomez jgarte

🎯
Focusing
View GitHub Profile
double_it : IO ()
double_it = do
input <- getLine
let n = the Int (cast input)
printLn (n * 2)
Idris> :t [1 .. 10]
enumFromTo 1 10 : List Integer
Idris> :t [1 ..]
enumFrom 1 : Stream Integer
@jgarte
jgarte / pex.md
Created January 9, 2024 05:11 — forked from simeonf/pex.md
Creating a PEX from a python script

So you want to create a pex that packages your script and its dependencies?

Ok - first to make our script! Call it foo.py:

import requests

if __name__ == '__main__':
  req = requests.get("https://raw.githubusercontent.com/pantsbuild/pex/master/README.rst")
  print req.text.split("\n")[0]
@jgarte
jgarte / permutations_ins_into_all_positions.ml
Created November 27, 2023 04:10 — forked from MassD/permutations_ins_into_all_positions.ml
A implementation for generating all permutations of a list, written in OCaml
(* note that in order to preserve certain order
and also show the conciseness of the implementation,
no tail-recursive is used *)
let ins_all_positions x l =
let rec aux prev acc = function
| [] -> (prev @ [x]) :: acc |> List.rev
| hd::tl as l -> aux (prev @ [hd]) ((prev @ [x] @ l) :: acc) tl
in
aux [] [] l
@jgarte
jgarte / eglot-rust-analyzer.el
Created May 5, 2023 06:43 — forked from casouri/eglot-rust-analyzer.el
Configuring eglot for rust-analyzer
;; How to translate LSP configuration examples into Eglot’s format:
;;
;; Usually LSP servers will say something like
;;
;; rust-analyzer.procMacro.attributes.enable (default: true)
;;
;; Translate that into a JSON LSP configuration, you get
;;
;; {
;; "rust-analyzer": {
@jgarte
jgarte / chatgpt.el
Created January 22, 2023 01:52 — forked from Gavinok/chatgpt.el
chatgpt client for emacs WIP (Now Async!)
;;; chatgpt.el --- Simple ChatGPT frontend for Emacs -*- lexical-binding: t -*-
;; Copyright (C) Gavin Jaeger-Freeborn
;; This package is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; This package is distributed in the hope that it will be useful,
@jgarte
jgarte / AOC-d1.el
Created December 21, 2022 05:32 — forked from Gavinok/AOC-d1.el
Emacs lisp solution for day one of advent of code 2022
(defun cals-per-elf ()
(with-temp-buffer
(progn (insert "((")
(insert-file-contents "~/res.txt")
(while (re-search-forward "^$" nil t)
(replace-match ")(" nil nil))
(end-of-buffer)(insert "))")
(goto-char 0))
(mapcar (lambda (food-carried)
(cl-reduce #'+ food-carried))
{ pkgs }:
let
lib = pkgs.lib;
in
# list of additional packages to add to the packageset
additionalPackages:
# source path of the package (derivation or (filtered) nix path)
assert (lib.all (pkg: pkg ? src) additionalPackages);
# dhall file of that package
@jgarte
jgarte / tinder-api-documentation.md
Created October 25, 2022 02:07 — forked from rtt/tinder-api-documentation.md
Tinder API Documentation

Tinder API documentation

Note: this was written in April/May 2014 and the API may has definitely changed since. I have nothing to do with Tinder, nor its API, and I do not offer any support for anything you may build on top of this. Proceed with caution

http://rsty.org/

I've sniffed most of the Tinder API to see how it works. You can use this to create bots (etc) very trivially. Some example python bot code is here -> https://gist.github.com/rtt/5a2e0cfa638c938cca59 (horribly quick and dirty, you've been warned!)

;;; -*- Mode:Lisp; Syntax:ANSI-Common-Lisp; Package: ASDF-USER -*-
(in-package :asdf-user)
(defsystem :my-new-system
:description ""
:author "Ed L <[email protected]>"
:license "MIT"
:depends-on (#:alexandria
#:uiop
#:serapeum