;;;; Devops tunings
;; (use-package ansible)
;; (ansible::set-default-keymap)
(use-package yaml-mode
:config
(add-to-list 'auto-mode-alist '("\\.yml\\'" . yaml-mode))
(add-hook 'yaml-mode-hook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun todo-create-directory (directory) | |
"Creates the todo directory." | |
(if (file-exists-p directory) (message "Directory exists") | |
(make-directory directory) | |
(message "Directory created") | |
)) | |
(defun create-todo-file (directory filename) | |
"Checks if the todo file exists if not creates it." | |
(todo-create-directory directory) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Read the inserted word out loud using the macOS speech synthesizer | |
;; when a misspelled word is corrected using the flyspell | |
;; `flyspell-auto-correct-word'-command. | |
;; | |
;; Note this only work on macOS. It should be fairly easy to change to | |
;; work with other command line interface speech synthesize systems. | |
;; | |
;; In a previous version this used to be a defadvice, but I've changed | |
;; it to implementing a custom flyspell insert function. This seems to | |
;; work a bit more reliably. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro nth-expr (n &rest args) | |
(let ((g (gensym))) | |
`(let ((,g (1- ,n))) | |
(eval (nth ,g ',args))))) ; TODO: make this work without eval function | |
(defun watch () (print 'evaluated!)) | |
(let ((n 2)) | |
(macroexpand-1 '(nth-expr n (watch) (+ 1 3) 'value))) | |
(let ((n 2)) | |
(nth-expr n (watch) (+ 1 3) 'value)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
"""Cause git to detect a merge conflict when two branches have migrations.""" | |
# myapp/management/commands/makemigrations.py | |
# you'll need myapp/management/commands/__init__.py and myapp/management/__init__.py in PY2, see Django docs | |
from __future__ import absolute_import, unicode_literals | |
import io | |
import os | |
import six |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main() { | |
slice := make([]int, 159) | |
// Split the slice into batches of 20 items. | |
batch := 20 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE RecordWildCards, Arrows #-} | |
import Numeric | |
import Data.Char | |
import Control.Monad | |
import Data.Monoid ((<>)) | |
import Data.List (nub, sort, reverse) | |
data RepeatBounds = RB |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
JDK_TAG=8_jdk-dcevm_unlimited | |
DOCKER_IMAGE='anapsix/alpine-java:'$JDK_TAG | |
JDK_HOME=~/bin/$JDK_TAG | |
docker pull ${DOCKER_IMAGE} | |
update_jdk() { | |
echo 'update JDK version...' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# https://developers.supportbee.com/blog/setting-up-cucumber-to-run-with-Chrome-on-Linux/ | |
# https://gist.github.com/curtismcmullan/7be1a8c1c841a9d8db2c | |
# https://stackoverflow.com/questions/10792403/how-do-i-get-chrome-working-with-selenium-using-php-webdriver | |
# https://stackoverflow.com/questions/26133486/how-to-specify-binary-path-for-remote-chromedriver-in-codeception | |
# https://stackoverflow.com/questions/40262682/how-to-run-selenium-3-x-with-chrome-driver-through-terminal | |
# https://askubuntu.com/questions/760085/how-do-you-install-google-chrome-on-ubuntu-16-04 | |
# Versions | |
CHROME_DRIVER_VERSION=`curl -sS https://chromedriver.storage.googleapis.com/LATEST_RELEASE` |
Want to use Nix for development but you're not sure how? Concerned about the
fluidity of nixpkgs
channels or not being able to easily install arbitrary
package versions?
When I first heard about Nix it seemed like the perfect tool for a developer. When I tried to actually use it for developing and deploying web apps, though, the pieces just didn't seem to add up.