Skip to content

Instantly share code, notes, and snippets.

View vpatryshev's full-sized avatar
💭
married

Vlad Patryshev vpatryshev

💭
married
View GitHub Profile
@alvinj
alvinj / sbtmkdirs.sh
Last active June 22, 2024 15:13
A shell script to create an SBT project directory structure
#!/bin/bash
#------------------------------------------------------------------------------
# Name: sbtmkdirs
# Version: 1.5
# Purpose: Create an SBT project directory structure with a few simple options.
# Author: Alvin Alexander, http://alvinalexander.com
# License: Creative Commons Attribution-ShareAlike 2.5 Generic
# http://creativecommons.org/licenses/by-sa/2.5/
#------------------------------------------------------------------------------
@graydon
graydon / docker-osx-shared-folders.rst
Last active June 2, 2024 00:18 — forked from codeinthehole/docker-osx-shared-folders.rst
How to share folders with docker containers on OSX

How to share a folder with a docker container on OSX

Mounting shared folders between OSX and the docker container is tricky due to the intermediate boot2docker VM. You can't use the usual docker -v option as the docker server knows nothing about the OSX filesystem - it can only mount folders from the boot2docker filesystem. Fortunately, you can work around this using SSHFS.

@pchiusano
pchiusano / monads.u
Last active April 27, 2024 08:18
Converting between algebraic effects and monads
-- This gist shows how we can use abilities to provide nicer syntax for any monad.
-- We can view abilities as "just" providing nicer syntax for working with the
-- free monad.
ability Monadic f where
eval : f a -> a
-- Here's a monad, encoded as a first-class value with
-- two polymorphic functions, `pure` and `bind`
type Monad f = Monad (forall a . a -> f a) (forall a b . f a -> (a -> f b) -> f b)
@muammar
muammar / getFirafonts.sh
Created May 23, 2016 08:41
Download and install Fira fonts in Linux or Mac OS X
#!/bin/bash
## cf from http://programster.blogspot.com/2014/05/ubuntu-14-desktop-install-fira-sans-and.html
cd /tmp
# install unzip just in case the user doesn't already have it.
if [[ `uname` = Linux ]]; then
sudo apt-get install unzip -y
wget "http://www.carrois.com/downloads/fira_4_1/FiraFonts4106.zip"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@luisuribe
luisuribe / gist:826504
Created February 14, 2011 20:41
git gist
// Clone just one branch
mkdir $BRANCH
cd $BRANCH
git init
git remote add -t $BRANCH -f origin $REMOTE_REPO
git checkout $BRANCH
// Aliases and stuff
git config --global user.name "Luis Uribe"
@vmarquez
vmarquez / TxMapTest.scala
Last active November 28, 2021 12:33
A mini STM if you will. I've made a'Transactional' map that mutates in a referentially transparent way.
import java.util.concurrent.atomic.AtomicReference
import java.util.concurrent.CountDownLatch
import scala.concurrent.Future
import scala.concurrent.ExecutionContext
import ExecutionContext.Implicits.global
object TxMapTest {
/*
* Example Usage
* We want to show two threads working with the same data source having both of their effects succeed
@jaytaylor
jaytaylor / EnvHacker.scala
Created August 21, 2014 02:41
Setting environment variables in Scala JVM
trait EnvHacker {
/**
* Portable method for setting env vars on both *nix and Windows.
* @see http://stackoverflow.com/a/7201825/293064
*/
def setEnv(newEnv: Map[String, String]): Unit = {
try {
val processEnvironmentClass = Class.forName("java.lang.ProcessEnvironment")
val theEnvironmentField = processEnvironmentClass.getDeclaredField("theEnvironment")
theEnvironmentField.setAccessible(true)
@kristopherjohnson
kristopherjohnson / lunar.rs
Last active August 15, 2020 19:23
Translation of classic Lunar Lander game from FOCAL to Rust
//! Translation of
//! <http://www.cs.brandeis.edu/~storer/LunarLander/LunarLander/LunarLanderListing.jpg>
//! by Jim Storer from FOCAL to Rust.
use std::error::Error;
use std::io;
use std::io::prelude::*;
use std::marker::{Send, Sync};
use std::process;
use std::str::FromStr;