A beginner-friendly REPL that combines
#!/bin/sh | |
# This script will fetch the Googlevideo ad domains and append them to the Pi-hole block list. | |
# Run this script daily with a cron job (don't forget to chmod +x) | |
# More info here: https://discourse.pi-hole.net/t/how-do-i-block-ads-on-youtube/253/136 | |
# File to store the YT ad domains | |
FILE=/etc/pihole/youtube.hosts | |
# Fetch the list of domains, remove the ip's and save them | |
curl 'https://api.hackertarget.com/hostsearch/?q=googlevideo.com' \ |
(ns pms.core | |
(:require [clojure.spec.alpha :as s] | |
[clojure.spec.gen.alpha :as gen] | |
[clojure.spec.test.alpha :as stest])) | |
(comment "This is a small experiment inspired by Oskar Wickströms | |
excellent work at | |
https://haskell-at-work.com/episodes/2018-01-19-domain-modelling-with-haskell-data-structures.html. I | |
wanted to see what would be involved in building the equivalent | |
functionality in reasonably ideomatic Clojure. It is also my first |
Start up the new cljs.main
with Node:
clj -Sdeps '{:deps {org.clojurescript {:git/url "https://github.com/clojure/clojurescript" :sha "3f4084efcb5cd92cceb8ca30765144691d8cfd7e"}}}' -m cljs.main -re node
The above works by specifying ClojureScript as a "git dep" and you can ensure that you are running the very latest by replacing the
:sha
value with the latest commit SHA at https://github.com/clojure/clojurescript.
In an effort to gain at least a superficial understanding of the technical implementation of cryptocurrencies, I recently worked my way through "Learn Blockchains by Building One" using Clojure.
This was a good chance to experiment with using spec in new ways. At work, we primarily use spec to validate our global re-frame state and to validate data at system boundaries. For this project, I experimented with using instrumentation much more pervasively than I had done elsewhere.
This is not a guide to spec (there are already many excellent resources for this). Rather, it's an experience report exploring what went well, what is still missing, and quite a few unanswered questions for future research. If you have solutions for any of the problems I've presented, please let me know!
You don't need to know or care about blockchains to understand the code be
- http://stackoverflow.com/questions/804115 (
rebase
vsmerge
). - https://www.atlassian.com/git/tutorials/merging-vs-rebasing (
rebase
vsmerge
) - https://www.atlassian.com/git/tutorials/undoing-changes/ (
reset
vscheckout
vsrevert
) - http://stackoverflow.com/questions/2221658 (HEAD^ vs HEAD~) (See
git rev-parse
) - http://stackoverflow.com/questions/292357 (
pull
vsfetch
) - http://stackoverflow.com/questions/39651 (
stash
vsbranch
) - http://stackoverflow.com/questions/8358035 (
reset
vscheckout
vsrevert
)
(ns inspect | |
(:require [cheshire.core :refer [generate-string]] | |
[clojure.java.io :as io]) | |
(:import (java.net Socket) | |
(def host "localhost") | |
(def port 9000) | |
(defn cinspect [data] | |
(with-open [sock (Socket. host port) |
#!/usr/bin/env bash | |
set -euo pipefail && cd "$(dirname "${BASH_SOURCE[0]}")/.." | |
# When you're down and out | |
# When you're on the street | |
# When evening falls so hard, I will comfort you | |
# I will clean your build artifacts | |
# Disclaimer: use at your own risk |
pragma solidity ^0.4.11; | |
contract BikramSamvat{ | |
/* | |
* Unix timestamp to Bikram Samvat (Date Time Library) | |
* @NepalBitcoin | |
*/ | |
address Bikram; | |
enum DaysInWeek{SUN,MON,TUE,WED,THU,FRI,SAT} |
- Create user
eth-netcompile
withuseradd
sudo mkdir /usr/local/gitproject
- in
/usr/local/gitproject
,git clone [email protected]:swaldman/eth-netcompile.git
- in
/usr/local/gitproject/eth-netcompile
,/usr/local/pkg/node/bin/npm install --save
to get dependencies - Install the
eth-netcompile.service
file (also in this gist) in/usr/lib/systemd/system/
- Make a symlink from
/etc/systemd/system/multi-user.target.wants/eth-netcompile.service
to/usr/lib/systemd/system/eth-netcompile.service
systemctl enable eth-netcompile.service
followed bysystemctl start eth-netcompile.service
- Verify that logging goes to the systemd journal with
journalctl --follow -u eth-netcompile