Skip to content

Instantly share code, notes, and snippets.

Avatar

Kyle Parisi kyleparisi

View GitHub Profile
View top-folders.sh
du -hs * | sort -rh | head -5
# fix older than 30 days
find -name "*.log" /var/lib/rundeck -type f -mtime +30 -exec rm -f {} \;
@kyleparisi
kyleparisi / sample.ex
Created Mar 20, 2020
Get ip that starts with, using elixir
View sample.ex
Enum.filter(interfaces, fn i -> List.starts_with?(Tuple.to_list(elem(i, 0)), [10, 242]) end) |> hd |> elem(0)
View django_script.py
import csv
import os
from types import SimpleNamespace
from utils.logging import logger
PROJECT_PATH = os.path.abspath(os.path.dirname(__name__))
def run():
View docker_events.ex
# {:httpoison, "~> 1.6"} in mix.exs -> deps
defmodule DockerEvents do
use GenServer
def start_link(opts \\ []) do
GenServer.start_link(__MODULE__, :ok, opts)
end
def init(:ok) do
sock = URI.encode_www_form("/var/run/docker.sock")
View alpine-community-v-local.md
root@ip-10-0-0-212:~# # from community
root@ip-10-0-0-212:~# apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/community zerotier-one
fetch http://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/community/x86_64/APKINDEX.tar.gz
(1/2) Installing zerotier-one (1.4.6-r0)
(2/2) Installing zerotier-one-openrc (1.4.6-r0)
Executing busybox-1.30.1-r2.trigger
OK: 268 MiB in 94 packages
@kyleparisi
kyleparisi / .env.testing
Last active Jan 28, 2020
Laravel + Docker testrig (alternative to homestead/valet?). Requires only docker as local dependency.
View .env.testing
APP_ENV=testing
APP_KEY=base64:blahblah
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=homestead
View button.js
window.addClass = function(el, className) {
if (el.classList) el.classList.add(className);
else el.className += " " + className;
};
window.removeClass = function(el, className) {
if (el.classList) el.classList.remove(className);
else
el.className = el.className.replace(
new RegExp("(^|\\b)" + className.split(" ").join("|") + "(\\b|$)", "gi"),
View composer.sh
#!/usr/bin/env bash
docker run --rm --interactive --tty \
--user $(id -u):$(id -g) \
--volume $PWD:/var/www/default \
--workdir /var/www/default \
--entrypoint "composer" \
kyleparisi/larasible $1
@kyleparisi
kyleparisi / acme.sh
Last active Apr 28, 2018
For reference
View acme.sh
acme.sh --issue --dns dns_dnsimple -d example.com -d www.example.com