Skip to content

Instantly share code, notes, and snippets.

Peter Marreck pmarreck

  • formerly, and currently a contractor
  • Long Island, NY
  • Sign in to view email
Block or report user

Report or block pmarreck

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
pmarreck /
Created May 14, 2019
Notes on In-House/Cloud Backup Solutions Across All Popular OS'es I Researched

Since it was a lot of work to figure all this out i figured i'd let others know: So I have an assortment of machines on various OS'es now at home, macs, windows, linux. I needed a way to (ideally) back everything up the same way. Also, Apple's Time Machine, as easy as it is to use, was starting to piss me off, at least over a network (taking forever, causing the computer to lag terribly, often saying it had to rebuild the entire backup from scratch, that sort of thing... It always worked fine to a local disk, but I wanted reliable network backup) I decided early on to stick to using S3 protocol to a FreeNAS Mini I already own since pretty much all the backup software I was evaluating was able to speak S3, from all the OS'es. This would also make it easy to switch to actual cloud down the line if that made sense. S3 support provided by Minio was recently added to my FreeNAS and it turns out, Minio is also easily installable on OS X (via Homebrew) and Linux, which meant that I could use my Ma

pmarreck / zip to 7z.bat
Created Apr 17, 2019
How to convert a directory of .zip files to .7z (7zip) in Windows
View zip to 7z.bat
for %%F in (*.zip) do ( "C:\Program Files\7-Zip\7z.exe" x -y -o"%%F_tmp" "%%F" * & pushd %%F_tmp & "C:\Program Files\7-Zip\7z.exe" a -y -r -m0=lzma2 -mx=9 -t7z ..\"%%~nF".7z * & popd & rmdir /s /q "%%F_tmp" )
pmarreck / 7zip files individually.bat
Created Apr 17, 2019
How to 7zip (lzma2 @ max compression) a bunch of files individually in a directory in Windows (assuming you are already in said directory with the command prompt)
View 7zip files individually.bat
# Use this one-liner:
for %i in (*.*) do "c:\Program Files\7-Zip\7z.exe" a -m0=lzma2 -mx=9 "%~ni.7z" "%i"
pmarreck /
Last active Mar 13, 2018
Why You Should Just Use Mailto Links (Instead Of Writing A Weak, Partially-Featured Email Client Inside Your Web App)
pmarreck / procedural_vs_functional.exs
Created Feb 8, 2018
Trying to convert a procedural algorithm into an Elixir functional one.
View procedural_vs_functional.exs
defmodule OutcomesProcedural do
def partitions(cards, subtotal) do
for i <- 0..9, elem(cards,i)>0 do
case subtotal+i+1 do
x when x > 21 -> 0
x when x==21 -> 1
x when x < 21 -> 1+partitions(put_elem(cards, i, elem(cards,i)-1), x)
pmarreck / brunch-config.js
Created Jan 10, 2018
My working brunch-config.js
View brunch-config.js
exports.config = {
// See for docs.
files: {
// javascripts: {
// joinTo: {
// "js/app.js": '*.min.js'
// }
// },
// stylesheets: {
// // joinTo: 'css/app.css',
pmarreck / instructions.bash
Last active Oct 29, 2017
How to get Erlang, Elixir, Phoenix and Postgres set up on a new blank Ubuntu ( project/VM
View instructions.bash
# I had some issues with this and finally culled together instructions from various sites which finally worked
# The first thing you should do is clone your Phoenix/Elixir repo from Github to a blank Ubuntu VM
# The next thing we have to do is remove the stock Erlang which is erlang-base-hipe and not esl-erlang
# (this causes problems later on otherwise)
# But first we will add a new apt source
sudo dpkg -i erlang-solutions_1.0_all.deb
rm erlang-solutions_1.0_all.deb # shouldn't need it anymore
pmarreck / for_all_the_things.exs
Created Oct 9, 2017
Examples of various uses of the "for" syntax in Elixir
View for_all_the_things.exs
# A list generator:
iex> for n <- [1, 2, 3, 4], do: n * 2
[2, 4, 6, 8]
# A comprehension with two generators
iex> for x <- [1, 2], y <- [2, 3], do: x * y
[2, 3, 4, 6]
# A comprehension with a generator and a filter
iex> for n <- [1, 2, 3, 4, 5, 6], rem(n, 2) == 0, do: n
pmarreck / ecto_postgres_fulltext_search_querying_example.ex
Last active May 8, 2019
How to set up postgres fulltext search triggers, index, and tsvector column on Elixir/Phoenix, with Ecto querying, including ranking and sorting by rank
View ecto_postgres_fulltext_search_querying_example.ex
defmodule YourAppName.Search do
# ...
@doc """
Queries listings.
def query_listings(query, current_user) do
default_scope = from l in Listing, where: l.draft == false or l.user_id == ^, order_by: [desc: l.updated_at], limit: 50
id = _try_integer(query)
pmarreck / implode_bloatware.ps1
Created Sep 29, 2017
windows powershell bloatware removal script
View implode_bloatware.ps1
get-appxpackage messaging | remove-appxpackage
get-appxpackage sway | remove-appxpackage
get-appxpackage commsphone | remove-appxpackage
get-appxpackage windowsphone remove-appxpackage
get-appxpackage phone | remove-appxpackage
get-appxpackage communicationsapps | remove-appxpackage
get-appxpackage people | remove-appxpackage
get-appxpackage zunemusic | remove-appxpackage
get-appxpackage zunevideo | remove-appxpackage
get-appxpackage zune | remove-appxpackage
You can’t perform that action at this time.