Skip to content

Instantly share code, notes, and snippets.

View nietaki's full-sized avatar
😌
purposeful

Jacek Królikowski nietaki

😌
purposeful
View GitHub Profile
@dmuth
dmuth / gist:5695205
Created June 2, 2013 22:38
/etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet dhcp
@nh2
nh2 / Hopfield-mini.hs
Created October 16, 2012 05:36
Hopfield networks - minimal Haskell implementation
import Data.Vector ((!))
import qualified Data.Vector as V
import Data.Vector.Generic.Mutable (write)
step ws state = case updatable of [] -> state
(i,_):_ -> V.modify (\v -> write v i (o i)) state
where
n = V.length state
w i j = ws ! i ! j
@pyetras
pyetras / 0bootstrap.sh
Last active September 13, 2016 22:00
OS X dotfiles
#AppStore: Install XCode
#install homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew doctor
brew update
curl https://gist.githubusercontent.com/pyetras/4b59e1902cfaf9af3c98/raw/Caskfile > Caskfile
curl https://gist.githubusercontent.com/pyetras/4b59e1902cfaf9af3c98/raw/Brewfile > Brewfile
@larroy
larroy / BinarySearch.scala
Last active January 8, 2017 06:56
Binary search in scala
import scala.annotation.tailrec
object BinarySearch {
/**
* @param xs Sequence to search
* @param key key to find
* @param min minimum index (inclusive)
* @param max maximum index (inclusive)
* @param keyExtract function to apply to elements xs before comparing to key, defaults as identity
* @tparam T type of elements in the sequence
@dciccale
dciccale / README.md
Last active May 22, 2018 09:14
Cross-browser triggerEvent function done with 127 bytes of JavaScript

triggerEvent

Cross-browser function to trigger DOM events.

// Processing code by Etienne JACOB
// motion blur template by beesandbombs
// opensimplexnoise code in another tab might be necessary
// --> code here : https://gist.github.com/Bleuje/fce86ef35b66c4a2b6a469b27163591e
int[][] result;
float t, c;
float ease(float p) {
@phaedryx
phaedryx / summary
Last active December 3, 2022 19:27
Loyalty and Layoffs by David Brady
Original text here: https://whydavewhy.com/2013/08/16/loyalty-and-layoffs/
@lshoo
lshoo / gist:9785645
Created March 26, 2014 15:13
Slick2 generic dao
package slicks.docs.dao
import scala.slick.driver.PostgresDriver.simple._
import scala.slick.driver._
trait Profile {
val profile: JdbcProfile
}
@pyzlnar
pyzlnar / ecto_iex_helpers.ex
Last active September 18, 2023 18:30
A few Ecto helpers that you might want to add to your .iex.exs file. Were created with PSQL in mind
import_if_available(Ecto.Query)
# alias MyApp.Repo
defmodule R do
# Old habits die hard. Take a random of something. You don't care which.
# > R.take(SomeSchema)
def take(schema_or_query) do
schema_or_query
|> limit(1)
|> Repo.one()
@lucasdavila
lucasdavila / fixup.txt
Last active December 20, 2023 12:00
Fixing mac os yosemite issue "bash: fork: Resource temporarily unavailable"
# see the current limits
$ sysctl -a | grep maxproc
# increase it
$ sudo sysctl -w kern.maxproc=xxxx
$ sudo sysctl -w kern.maxprocperuid=xxx
# run at startup
$ sudo vim /etc/sysctl.conf