Skip to content

Instantly share code, notes, and snippets.

View deffjay's full-sized avatar

Jeff Day deffjay

View GitHub Profile
@deffjay
deffjay / CentOS Web Server Firewall Config
Last active December 20, 2015 18:59
How to open up the firewall to allow port 80 (HTTP), 443 (HTTPS) and port 22 (SSH) for CentOS
# vim /etc/sysconfig/iptables
#
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
@deffjay
deffjay / AutoGrunt.py
Last active October 4, 2020 23:59
AutoGrunt
# Jeff Day - 2013
# Sublime plugin that invokes Grunt whenever the user saves a file within the current project.
# call to RSYNC project to remote server via RSync
#
# October 27, 2013 - Updated this to work using Sublime Text 3 (Jeff)
# November 10, 2013 - Now compatible with OSX Mavericks (Jeff)
# January 2, 2014 - Switched over to Grunt (Tom)
import sublime, sublime_plugin
import json, os, subprocess, functools

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@deffjay
deffjay / tmux-cheatsheet.markdown
Created October 20, 2015 03:20 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
mysql -h 127.0.0.1 -u root -p"*******" database < applications.sql
mysql -h 127.0.0.1 -u root -p"******" database < publishers.sql
@deffjay
deffjay / docker-cleanup-resources.md
Created February 27, 2018 18:52 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@deffjay
deffjay / gist:6e0de6bb767b8c0533049541a48b91bd
Last active September 30, 2019 19:25
Pretty print JSON from an object in Swift5
do {
let jsonEncoder = JSONEncoder()
jsonEncoder.outputFormatting = .prettyPrinted
let jsonData = try jsonEncoder.encode(palettes)
if let jsonString = String(data: jsonData, encoding: .utf8) {
print(jsonString)
}
} catch {
print("error")
}
@deffjay
deffjay / installing_clockwork_for_laravel.md
Last active July 18, 2020 07:13
Install clockwork profiling library for Laravel > 5.5

Install the Clockwork library via Composer.

$ composer require itsgoingd/clockwork --dev

If you are running the latest Laravel version, congratulations you are done!

By default, Clockwork will only be available in debug mode, you can change this and other settings in the configuration file. Use the vendor:publish Artisan command to publish the configuration file into your config directory.

@deffjay
deffjay / create_new_user.sh
Last active October 4, 2020 22:34
Properly creates a new user for CentOS/RHEL/Fedora/Debian
#!/bin/bash
# Create a new user named morpheus
useradd -m -s /bin/bash morpheus
# Add users to sudo or wheel group
usermod -aG sudo morpheus #Debian/Ubuntu
usermod -aG wheel morpheus #CentOS/RHEL
# Create Home Directory + .ssh Directory
@deffjay
deffjay / ffmpeg.md
Created November 16, 2021 03:12 — forked from liangfu/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: