Instantly share code, notes, and snippets.

IP_LOOKUP="$(ip route get | awk '{ print $NF; exit }')" # May not work for VPN / tun0
IPv6_LOOKUP="$(ip -6 route get 2001:4860:4860::8888 | awk '{for(i=1;i<=NF;i++) if ($i=="src") print $(i+1)}')" # May not work for VPN / tun0
#IP="${IP:-$IP_LOOKUP}" # use $IP, if set, otherwise IP_LOOKUP
IP="" # use $IP, if set, otherwise IP_LOOKUP
IPv6="${IPv6:-$IPv6_LOOKUP}" # use $IPv6, if set, otherwise IP_LOOKUP
DOCKER_CONFIGS="$(pwd)" # Default of directory you run this from, update to where ever.
echo "### Make sure your IPs are correct, hard code ServerIP ENV VARs if necessary\nIP: ${IP}\nIPv6: ${IPv6}"
docker run -d \
--name pihole \
View format-comic-list-entries.viml
function! InsertHyphensAndUnderscores()
execute "normal! i- wi_f#gea_"
function! InsertEmptyLines()
silent g/.\n\n\@!/norm o
function! FormatComicListEntries()
execute "normal! gg^VG:sort\<CR>"

When receiving JSON data from other resources(server API etc), we need Json.Decode to convert the JSON values into Elm values. This gist let you quickly learn how to do that.

I like to follow working example code so this is how the boilerplate will look like:

import Graphics.Element exposing (Element, show)
import Task exposing (Task, andThen)
import Json.Decode exposing (Decoder, int, string, object3, (:=))

import Http
View JacksonKotlinModuleExample.kt
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
fun main(args: Array<String>) {
// val mapper = ObjectMapper().registerModule(KotlinModule())
// val mapper = ObjectMapper().registerKotlinModule()
val mapper = jacksonObjectMapper()
val writer = mapper.writerWithDefaultPrettyPrinter()
val json1 = writer.writeValueAsString(Data1(1, "Foo", "Bar"))
View gist:4fea9016fee7300211a986d9fb68ee46
ffmpeg -y -t 10 -i -vf fps=10,scale=900:-1:flags=lanczos,palettegen palette.png;
ffmpeg -t 10 -i -i palette.png -filter_complex "fps=10,scale=900:-1:flags=lanczos[x];[x][1:v]paletteuse" output.gif
for file in crushed-*; do cp "$file" "${file/crushed-/}"; done
# Clear rbenv variables before starting tmux
tmux start-server;
cd .
View test-layout.yml
# /home/peter/.config/tmuxinator/test-layout.yml
name: test-layout
- email:
- echo zero
- echo one
- echo two
- echo three
  • manually create your layout
  • run either tmux list-windows outside of your session or run list-windows from inside your session in the (tmux) command prompt
  • the output will contain a substring like: [layout e1ce,158x43,0,0{79x43,0,0,1,78x43,80,0[78x10,80,0,2,78x10,80,11,5,78x10,80,22,3,78x10,80,33,4]}]
  • copy/massage the substring to look like the following and you should be set:
  - editor:
      layout: e1ce,158x43,0,0{79x43,0,0,1,78x43,80,0[78x10,80,0,2,78x10,80,11,5,78x10,80,22,3,78x10,80,33,4]}
View yield_self_demo.rb
modified_str = "foo"
.yield_self { |str| str.split('') }
.yield_self { |str| str.join('-') }
.yield_self { |str| "#{str}!" }
puts modified_str # F-O-O!