Skip to content

Instantly share code, notes, and snippets.

ssh -M -S /tmp/db-socket -fnNT -L 3306:[RDS_ENDPOINT]:3306 [USER]@[BASTION_HOST]
@joshkitt
joshkitt / aws-ec2-userdata-java.sh
Last active July 30, 2020 15:19
AWS EC2 User Data with Java
#!/bin/bash
sudo su
yum update -y
yum install -y httpd
amazon-linux-extras install java-openjdk11
systemctl start httpd.service
systemctl enable httpd.service
EC2_AVAIL_ZONE=$(curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone)
echo "<h1>Hello World from $(hostname -f) in AZ $EC2_AVAIL_ZONE </h1>" > /var/www/html/index.html
@joshkitt
joshkitt / ffmpeg.md
Created May 20, 2020 00:08 — forked from protrolium/ffmpeg.md
using ffmpeg to extract audio from video files

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz:

@joshkitt
joshkitt / orbi.sh
Created April 17, 2020 03:37
Orbi disable auto update
Enable telnet: http://192.168.1.1/debug.htm
Telnet to device
nvram show | grep auto_*
nvram set orbi_auto_upgrade=0
nvram set auto_check_for_upgrade=0
nvram set auto_update=0
nvram commit
# start servers
zookeeper-server-start /usr/local/etc/kafka/zookeeper.properties
kafka-server-start /usr/local/etc/kafka/server.properties
# create topic producer
kafka-console-producer --broker-list localhost:9092 --topic hello
# create topic producer with group
kafka-console-producer --broker-list localhost:9092 --topic hello --group clienta
@joshkitt
joshkitt / gist:f163614b831fd246bb0a78dc61df2248
Created April 13, 2020 00:30
Disable MacBook Device Enrollment Notification nag popup
Restart into recovery mode
Terminal: csrutil disable
Restart into normal user mode
Terminal: sudo mount -uw /
Terminal: sudo mkdir /System/Library/LaunchAgentsDisabled; sudo mkdir /System/Library/LaunchDaemonsDisabled; sudo mv /System/Library/LaunchAgents/com.apple.ManagedClientAgent.agent.plist /System/Library/LaunchAgentsDisabled; sudo mv /System/Library/LaunchAgents/com.apple.ManagedClientAgent.enrollagent.plist /System/Library/LaunchAgentsDisabled; sudo mv /System/Library/LaunchDaemons/com.apple.ManagedClient.cloudconfigurationd.plist /System/Library/LaunchDaemonsDisabled; sudo mv /System/Library/LaunchDaemons/com.apple.ManagedClient.enroll.plist /System/Library/LaunchDaemonsDisabled; sudo mv /System/Library/LaunchDaemons/com.apple.ManagedClient.plist /System/Library/LaunchDaemonsDisabled; sudo mv /System/Library/LaunchDaemons/com.apple.ManagedClient.startup.plist /System/Library/LaunchDaemonsDisabled
Restart into recovery mode
Terminal: csrutil enable
@joshkitt
joshkitt / minecraft.sh
Last active March 27, 2020 17:45
Install Minecraft Server on AWS EC2
# create Elastic Compute Cloud (EC2) instance in preferred Virtual Private Cloud (VPC) and Subnet
# create and attach an Internet Gateway to the VPC (IGW)
# configure Route Table to route external traffic to IGW
# configure Security Group and NACL rules to allow traffic on port 25565
# install Java
sudo amazon-linux-extras install java-openjdk11
# download Minecraft Server - get the latest URL you would like
wget https://launcher.mojang.com/v1/objects/bb2b6b1aefcd70dfd1892149ac3a215f6c636b07/server.jar
@joshkitt
joshkitt / aws-docker.sh
Created March 27, 2020 17:16
Install docker on EC2 instance and configure for ec2-user
sudo yum install -y docker
sudo usermod -a -G docker ec2-user
sudo service docker start
@joshkitt
joshkitt / Dockerfile
Created March 11, 2020 18:06
Dockerfile for a Java Spring Boot app
FROM openjdk:13-alpine
WORKDIR /usr/src/myapp
COPY target/demo-*.jar /usr/src/myapp/demo.jar
RUN chmod 777 /usr/src/myapp/demo.jar
CMD ["java", "-jar", "/usr/src/myapp/demo.jar"]
EXPOSE 8080
@joshkitt
joshkitt / Dockerfile
Created March 11, 2020 18:05
Dockerfile for a Node app
FROM node:lts-stretch-slim
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm ci --only=production
COPY src .
CMD [ "node", "app.js" ]
EXPOSE 8080