Skip to content

Instantly share code, notes, and snippets.

View strobe's full-sized avatar

strobe strobe

View GitHub Profile
@dive
dive / fix-emacs-permissions-catalina.el
Created September 29, 2019 09:55
Fix Emacs permissions on macOS Catalina
;;; package --- Fix permissions for Emacs.app on macOS Catalina
;;; Author: Artem Loenko
;;; Mail-To: <artyom.loenko@mac.com>
;;; Commentary:
;;; Code:
(defconst _default-emacs-app-plist-path "/Applications/Emacs.app/Contents/Info.plist")
(defconst _temp-buffer-name "*fixing Emacs permissions*")
(defconst _temp-buffer (get-buffer-create _temp-buffer-name))
(with-current-buffer _temp-buffer (erase-buffer))
# nix-env -p /nix/var/nix/profiles/system --delete-generations old
# nix-collect-garbage -d
# nix-env -p /nix/var/nix/profiles/system --list-generations
## Remove entries from /boot/loader/entries:
# sudo bash -c "cd /boot/loader/entries; ls | grep -v <current-generation-name> | xargs rm"
@ianchen06
ianchen06 / del_cluster.sh
Created June 26, 2017 10:29
delete proxmox cluster
# source: https://forum.proxmox.com/threads/removing-deleting-a-created-cluster.18887/
#/bin/sh
# stop service
systemctl stop pvestatd.service
systemctl stop pvedaemon.service
systemctl stop pve-cluster.service
systemctl stop corosync
systemctl stop pve-cluster
# edit through sqlite, check, delete, verify
import scalaz.{-\/, Applicative, Coproduct, Free, FreeAp, Inject, Monad, NaturalTransformation, Nondeterminism, \/-, ~>}
import scala.language.{higherKinds, reflectiveCalls}
import scalaz.concurrent.Task
import Task._
import scala.util.Random
case class User(name: String, age: Int)
sealed trait UserOperation[T]
case class CreateUser(name: String, age: Int) extends UserOperation[User]
@jatcwang
jatcwang / gist:ae3b7019f219b8cdc6798329108c9aee
Created February 2, 2017 23:44
List of all setxkbmap configuration options (including models/layout/etc)
! model
pc101 Generic 101-key PC
pc102 Generic 102-key (Intl) PC
pc104 Generic 104-key PC
pc105 Generic 105-key (Intl) PC
dell101 Dell 101-key PC
latitude Dell Latitude series laptop
dellm65 Dell Precision M65
everex Everex STEPnote
flexpro Keytronic FlexPro
@notxcain
notxcain / cofree.scala
Created December 13, 2016 08:32
Streams for (Co)free
import cats.data.Kleisli
import cats.implicits._
import cats.{Applicative, FlatMap, Functor, Monad, Monoid, ~>}
final case class Cofree[F[_], A](head: A, tail: F[Cofree[F, A]]) {
def map[B](f: A => B)(implicit F: Functor[F]): Cofree[F, B] =
Cofree(f(head), F.map(tail)(_.map(f)))
def zip[B](other: Cofree[F, B])(implicit F: Applicative[F]): Cofree[F, (A, B)] =
Cofree((head, other.head), (tail |@| other.tail).map(_ zip _))
sealed trait Task[A] {
import Task._
final def flatMap[B](f: A => Task[B]): Task[B] = Suspend(this, f)
final def map[B](f: A => B): Task[B] = this match {
case Suspend(inner, suspension) =>
Suspend(inner, suspension andThen { _ map f })
case Async(body) =>

Applied Functional Programming with Scala - Notes

Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
@pvoznenko
pvoznenko / circe-loop-json-object-example.md
Last active May 11, 2018 19:25
How to loop through json object and change values with circe, scala

How to go through json object and change values with Circe in Scala

Small gist with some demo trait that shows an example on how to loop through json object and change values with circe in Scala.

Code example you can find below at circe-loop-json-object-example.scala.

The input JSON for test is kinda in in DynamoDB dump format:

@ba0f3
ba0f3 / compile-emacs.sh
Last active July 19, 2017 02:00
Compile emacs 25.1 on CentOS 6.x
yum install gcc make ncurses-devel giflib-devel libjpeg-devel libtiff-devel
wget http://ftp.twaren.net/Unix/GNU/gnu/emacs/emacs-25.1.tar.xz
tar xJf emacs-*
cd emacs-*
./configure --without-x --without-selinux
make && make install