Skip to content

Instantly share code, notes, and snippets.

View excenter's full-sized avatar

Andrew Batz excenter

View GitHub Profile
@lw-thomaswood
lw-thomaswood / rhel8-docker-install.txt
Last active November 9, 2020 17:11
Docker in RHEL/CentOS 8
Assistance from this article: https://www.liquidweb.com/kb/how-to-install-docker-on-centos-8/
=============================
Introduction
=============================
Red Hat and Docker broke up which means you can't just install Docker in CentOS or RHEL 8 and expect it to work.
In fact if you follow the docker instructions to install, you *will* get some of docker installed but when you try to start the service it will bomb.
So how do we get around this? Trick yum (or dfn) into thinking we're running release 7. Then install Docker and Docker Compose.
=============================
Procedure
@ernestboey
ernestboey / Dockerfile
Last active July 3, 2023 20:21
Create Docker image with Alpine 3.9 + Golang 1.12.9 + Node.js 10.16.3
FROM node:10.16.3-alpine
# Golang From: https://github.com/docker-library/golang/blob/master/1.12/alpine3.10/Dockerfile
RUN apk add --no-cache \
ca-certificates
# set up nsswitch.conf for Go's "netgo" implementation
# - https://github.com/golang/go/blob/go1.9.1/src/net/conf.go#L194-L275
# - docker run --rm debian:stretch grep '^hosts:' /etc/nsswitch.conf
RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
@excenter
excenter / grab_complete_node.py
Created March 18, 2019 03:35
py2neo cheat sheet
from py2neo import Graph, Node, Relationship
graph = Graph(
host="alpha.graph.domain.co",
auth=('neo4j', 'thePassword-butBetter')
)
url="https://py2neo.org/v4/database.html#py2neo.database.Graph.delete_all"
a = Node("Type", url=url)
graph.merge(a, "Website", "url")
import boto3
def creation_table_scaling(table_name: str, key_name: str, key_type: str, max_read_capacity: int, max_write_capacity: int):
"""
Create table dynamodb and make it scale then wait for it to be created
Args:
table_name (str): the name of the table to create
key_name (str): the name of the key, and main attribute of the table
key_type (str): the data type for the attribute, S for string, N for number, B for binary
max_read_capacity(int) : Max nb of read per minute
@siklodi-mariusz
siklodi-mariusz / Dockerfile
Created January 30, 2018 19:40
Dockerfile example for Ruby on Rails running on Alpine Linux
FROM ruby:2.4-alpine3.7
# Install dependencies:
# - build-base: To ensure certain gems can be compiled
# - nodejs: Compile assets
# - postgresql-dev postgresql-client: Communicate with postgres through the postgres gem
# - libxslt-dev libxml2-dev: Nokogiri native dependencies
# - imagemagick: for image processing
RUN apk --update add build-base nodejs tzdata postgresql-dev postgresql-client libxslt-dev libxml2-dev imagemagick
@posener
posener / go-shebang-story.md
Last active March 29, 2024 08:38
Story: Writing Scripts with Go

Story: Writing Scripts with Go

This is a story about how I tried to use Go for scripting. In this story, I’ll discuss the need for a Go script, how we would expect it to behave and the possible implementations; During the discussion I’ll deep dive to scripts, shells, and shebangs. Finally, we’ll discuss solutions that will make Go scripts work.

Why Go is good for scripting?

While python and bash are popular scripting languages, C, C++ and Java are not used for scripts at all, and some languages are somewhere in between.

@subfuzion
subfuzion / dep.md
Last active June 14, 2023 15:46
Concise guide to golang/dep

Overview

This gist is based on the information available at golang/dep, only slightly more terse and annotated with a few notes and links primarily for my own personal benefit. It's public in case this information is helpful to anyone else as well.

I initially advocated Glide for my team and then, more recently, vndr. I've also taken the approach of exerting direct control over what goes into vendor/ in my Dockerfiles, and also work from isolated GOPATH environments on my system per project to ensure that dependencies are explicitly found under vendor/.

At the end of the day, vendoring (and committing vendor/) is about being in control of your dependencies and being able to achieve reproducible builds. While you can achieve this manually, things that are nice to have in a vendoring tool include:

#!/usr/bin/python
# Credit to frogor for the objc
from Foundation import NSBundle
import json
import objc
import os
import plistlib
import subprocess
@NeuroWinter
NeuroWinter / ffmpeg cheatsheet for glitching
Last active April 13, 2024 09:09
ffmpeg cheatsheet for glitching
FFMPEG '-i', file, '-c:v', 'libopenjpeg', "jpeg2000\\" + name + ".jp2"\
Convert image to jpeg2000
ffmpeg -i in.png -c:v libopenjpeg out.jp2
Hex Edit out.jp2
ffmpeg -i in.jp2 -c:v png out.png
General Edit
ffmpeg -i input.avi -c:v mpeg2video -g 999 -q:v 1 output.avi
*edit in avidemux/whatever*