Skip to content

Instantly share code, notes, and snippets.

View dwhelan's full-sized avatar

Declan Whelan dwhelan

View GitHub Profile
#!/usr/bin/bash
# From https://gist.github.com/zeroseis/ce66d4c6b776577442a6
#
# Changed location from Contents/Resources to Contents/Helpers (looks like they moved it)
PID=$(ps -fe | grep "[A]ndroid File Transfer Agent" | awk '{print $2}');
if [[ -n $PID ]]; then kill $PID; fi;
mv "/Applications/Android File Transfer.app/Contents/Helpers/Android File Transfer Agent.app" "/Applications/Android File Transfer.app/Contents/Helpers/Android File Transfer Agent DISABLED.app";
mv "${HOME}/Library/Application Support/Google/Android File Transfer/Android File Transfer Agent.app" "${HOME}/Library/Application Support/Google/Android File Transfer/Android File Transfer Agent DISABLED.app";
osascript -e 'tell application "System Events" to delete every login item whose name is "Android File Transfer Agent"'
@dwhelan
dwhelan / printer_install.md
Created August 14, 2021 20:50
Setup for Raspberry PI 4 printer server using CUPS and legacy support for Samsung printers

Update

sudo apt-get update
sudo apt-get upgrade
reboot

Install cups

sudo apt-get install cups
@dwhelan
dwhelan / gist:f3dfbf8b4927099c03e750e5c7f034f8
Created March 2, 2018 06:41
Print generated Elixir code in a macro to stdio
defmodule Something do
defmacro __using__(opts) do
x = quote do
import unquote __MODULE__
@behaviour Doit.Processor
unquote build_process_funs(opts, __CALLER__)
end
# x |> Macro.expand(__ENV__) |> Macro.to_string |> IO.puts
@dwhelan
dwhelan / test_helper.exs
Last active May 24, 2018 00:38
Replicate RSpec "focus" mode with ExUnit
ExUnit.start(
exclude: [:skip], include: [
# Uncomment the line below to only run tests with "@tag :focus"
:focus], exclude: [:test
]
)
@dwhelan
dwhelan / nucleotide_count.exs
Created January 18, 2018 02:32
Exercism.io solutions from Elixir Magic meetup
defmodule NucleotideCount do
@nucleotides [?A, ?C, ?G, ?T]
@doc """
Counts individual nucleotides in a NucleotideCount strand.
## Examples
iex> NucleotideCount.count('AATAA', ?A)
4
@dwhelan
dwhelan / name.ex
Last active December 24, 2017 05:09
If you have a name with "la" in it, allows you to Elixirify your name where your name can be represented with valid pipelined Elixir functions. For example, if your name is "declan" then dec|>n returns "declan").
iex> c "lib/name.ex"
[MyName, ElixirName]
iex> MyName.is
"declan
@dwhelan
dwhelan / edges.md
Created April 23, 2017 20:20
Edges

Edges

  • definition
  • taxonomy
  • patterns
  • refactorings

Definition

An edge is a discontinuity along some dimension in our system code.

An edge can exist as essential complexity in the domain. Or an edge can exist as accidental complexity we have added to our code.

@dwhelan
dwhelan / Commenter.rb
Created December 22, 2015 15:36
Code commenter
class Commenter
def comment(source)
output = []
Open3.popen3(ENV, 'irb', '-f', '--noprompt', '--noverbose') do |stdin, stdout, stderr, wait_thr|
source.each do |line|
if empty_line?(line)
output << line
else
stdin.puts line
output << add_output_to_line(line, stdout.readline)