Skip to content

Instantly share code, notes, and snippets.

View imsmith's full-sized avatar

Ian Smith imsmith

  • Seattle
  • 16:37 (UTC -07:00)
View GitHub Profile
@rhasselbaum
rhasselbaum / GoogleMusicPlayListExport.md
Last active February 15, 2021 15:24
Export Google Music Playlists to M3U

Recently, I decided to migrate my music library from Google Play Music to a self-hosted server running Subsonic. Only problem is I have a bunch of playlists, and Google provides no way to export those into any format that Subsonic can consume (m3u, pls, xspf). I also couldn't find an unofficial tool to do this. The best I could find was a handy app in the Play store called Playlist Backup. It can't export playlists for music stored remotely at Google, but it can create lists of albums and tracks names. Good enough! Now all I needed was a utility that could employ some fuzzy logic to match these lists to my local music files, which follow a typical Artist / Albumn / Track hierarchy.

Turns out, Python 3 makes this really easy! Just copy the script below:

playlist-gen.py:

#!/usr/bin/env python3

# Converts a list of audio tracks 
@trojanh
trojanh / Transformer.ex
Last active March 16, 2022 07:35
Create Image thumbnail using ImageMagick in Elixir
defmodule Image.Transformer do
def transform(original_file, operation \\ "convert") do
thumb_path = generate_thumb_file(original_file)
System.cmd(operation, operation_commands(original_file_path, thumb_path))
thumb_path
end
defp generate_thumb_file(original_file) do
@adrianmihalko
adrianmihalko / agistfile1.txt
Last active August 29, 2022 03:41
Selective routing trough VPN with Unifi USG.
I wanted to route only specific IPs trough a Wireguard interface. I am not expert in any way, but I am trying to explain you as best I can how I did it.
Setup a WG connection as usual on one of your device in your network (In my example I will call it "Ubuntu server", 192.168.1.54):
[Interface]
Address = something/24
PrivateKey = longprivatekeyR5FE=
Table = 43
PostUp = ip rule add from 192.168.1.91 table 43; iptables -w -A FORWARD -i %i -j ACCEPT; iptables -w -A FORWARD -o %i -j ACCEPT; iptables -w -t nat -A POSTROUTING -o ens160 -j MASQUERADE; iptables -t nat -A POSTROUTING -o %i -j MASQUERADE
@bertvv
bertvv / pandoc.Makefile
Last active November 24, 2022 08:55
Makefile for Markdown -> PDF using pandoc
# Generate PDFs from the Markdown source files
#
# In order to use this makefile, you need some tools:
# - GNU make
# - Pandoc
# - LuaLaTeX
# - DejaVu Sans fonts
# Directory containing source (Markdown) files
source := src
@ajeetraina
ajeetraina / docker-compose.yml
Created October 29, 2017 12:21
Docker Compose File for MacVLAN Network Driver ( Single Node)
version: '3.3'
services:
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
networks:
- myvlan
@shamangeorge
shamangeorge / apache-custom-directory
Last active December 22, 2022 07:00
apache virtual host with custom directory index configuration
<VirtualHost *:80>
ServerName www.example.com
# For local dev machines
ServerAlias staging.www.example.com
ServerAlias dev.www.example.com
DocumentRoot /var/www/www.example.com
<Directory /var/www/www.example.com>
Options +FollowSymlinks +Multiviews +Indexes
@idlehands
idlehands / 00_info.md
Last active May 20, 2023 11:28
-info and links
@mbrownnycnyc
mbrownnycnyc / nsclient_update.sh
Created May 24, 2013 15:41
script for use with `nsupdate` to update linux client DNS on a DNS server... in this instance, I am targeting a Windows Server DNS server 2003/2008/2012+. I have manually created the PTR and A records once, and granted the Everyone ACE the "Write" permission in the DACL of the PTR and A records.
#!/bin/sh
#original from http://community.spiceworks.com/topic/262635-linux-does-not-register-on-the-windows-ad-dns
# reply of Phil6196 Oct 1, 2012 at 12:41 AM (EDT)
ADDR=`/sbin/ifconfig eth0 | grep 'inet addr' | awk '{print $2}' | sed -e s/.*://`
HOST=`hostname`
echo "update delete $HOST A" > /var/nsupdate.txt
echo "update add $HOST 86400 A $ADDR" >> /var/nsupdate.txt
echo "update delete $HOST PTR" > /var/nsupdate.txt
echo "update add $HOST 86400 PTR $ADDR" >> /var/nsupdate.txt
nsupdate /var/nsupdate.txt
@guest271314
guest271314 / filestream.md
Created September 10, 2023 15:53
Creating a FIFO-type file stream pipe between the browser and local applications

Today we are going to create a FIFO (First In First Out) type file stream between the browser and a local application.

The idea is to create a local file in the browser, when the file is created the local application writes data to the newly created file, in the browser we will read the data written to the file up to that point, then truncate the file to size 0, repeat, when the writing and reading of the file are complete we will remove the file from the local file system.

In this way we can configure our local application to watch for the creation of specific named files, each performing a discrete process, and stream data from the local application to the file, without using networking.

We'll be using Deno in this example for the local application. Use whatever local application you want. Node.js, QuickJS, C,

@evadne
evadne / lecture.md
Last active October 4, 2023 23:24
How to Sell Elixir (2023)

How to Sell Elixir AGAIN (2023)

Presented by Evadne Wu at Code BEAM Lite in Stockholm, Sweden on 12 May 2023

Synopsis

We have celebrated 10 years of Elixir and also nearly 25 years of Erlang since the open source release in December 1998.

Most of the libraries that were needed to make the ecosystem viable have been built, talks given, books written, conferences held and training sessions provided. A new generation of companies have been built on top of the Elixir / Erlang ecosystem. In all measures, we have achieved further reach and maturity than 5 years ago.