Skip to content

Instantly share code, notes, and snippets.

View jdoss's full-sized avatar

Joe Doss jdoss

View GitHub Profile
@jdoss
jdoss / start_chrome_unstable.sh
Created March 29, 2015 02:56
Run Google Chrome Unstable (43.0.2342.2 dev) on a HiDPI screen.
#!/bin/bash
# Hacky fix for Google Chrome unstable (43.0.2342.2 dev) on a HiDPI screen.
# See https://code.google.com/p/chromium/issues/detail?id=469373 for more details
xprop -root -remove _NET_WORKAREA
google-chrome-unstable --force-device-scale-factor=2 > /dev/null 2>&1 &
@jdoss
jdoss / vz.conf
Created April 11, 2015 19:22
iptables settings for openvz hardware node
IPTABLES="ipt_REJECT ipt_tos ipt_TOS ipt_LOG ip_conntrack ipt_limit ipt_multiport iptable_filter iptable_mangle ipt_TCPMSS ipt_tcpmss ipt_ttl ipt_length ipt_state ip_nat_ftp ipt_recent ip_conntrack_ftp xt_mac ip_conntrack_irc ipt_owner ipt_REDIRECT iptable_nat, ip_tables"
IPTABLES_MODULES="$IPTABLES xt_connlimit nf_nat"
@jdoss
jdoss / convert_magick.text
Created July 24, 2015 19:54
Make thumbnails and optimize images
http://stackoverflow.com/questions/985725/tools-for-jpeg-optimization
http://www.imagemagick.org/script/command-line-options.php#gravity
http://superuser.com/questions/275476/square-thumbnails-with-imagemagick-convert
# Convert with focus on north gravity of image
convert -define jpeg:size=800x600 image1.jpg -thumbnail 800x600^ -gravity north -extent 800x600 image1_thumb.jpg
# Convert from the center of image
convert -define jpeg:size=800x600 image2.jpg -thumbnail 800x600^ -gravity center -extent 800x600 image2_thumb.jpg
@jdoss
jdoss / iwl7260-firmware_debug.txt
Last active August 29, 2015 14:28
iwl7260-firmware.noarch + Intel Corporation Wireless 7265 = crappy wifi party
# lspci |grep Wireless
04:00.0 Network controller: Intel Corporation Wireless 7265 (rev 59)
# uname -a
Linux 4.1.4-200.fc22.x86_64 #1 SMP Tue Aug 4 03:22:33 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
# /sbin/ethtool -i wlp4s0 |grep firm
firmware-version: 25.17.12.0
@jdoss
jdoss / ovs_libvirt.md
Created October 31, 2015 23:30
Configure Fedora Server with Open vSwitch and Libvirt

This will allow you to use Open vSwitch with Libvirt to put your VMs on the same network as the host and not use the default NAT based bridge.

Install Packages

dnf install -y virt-install libvirt openvswitch

Services Prep Work

Disable NetworkManager :(

@jdoss
jdoss / Vagrantfile
Created November 1, 2015 03:08
A Vagrantfile that works with Open vSwitch on :public_network
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.define :dev do |dev|
dev.vm.box = "centos/7"
dev.vm.hostname = "ansible"
dev.vm.network :public_network, :dev => "ovsbr0", :ovs => true
@jdoss
jdoss / fstab.awk
Created December 24, 2015 19:08
An attempt to use AWK to find and replace $1 based on line number.
awk '{ if (NR==1) {getroot = "blkid -s UUID /dev/fedora_server/root|cut -d: -f2"} {getroot |& getline root } {$1=root} \
if (NR==2) {close("getroot")}{getboot = "blkid -s UUID /dev/mmcblk0p1|cut -d: -f2"} {getboot |& getline boot} {$1=boot} {close("getboot")} \
if (NR==3) {close("getboot")}{getswap = "blkid -s UUID /dev/mmcblk0p2|cut -d: -f2"} {getswap |& getline swap} {$1=swap} } {close("getswap")}1' etc/fstab
@jdoss
jdoss / ec2.yml
Created February 7, 2017 16:47
List EC2 tags and set facts.
---
- name: Gather EC metadata facts
action: ec2_facts
- name: List tags on an instance
ec2_tag:
region: "{{ ansible_ec2_placement_region }}"
resource: "{{ ansible_ec2_instance_id }}"
state: list
register: instance
@jdoss
jdoss / bummer.txt
Created September 14, 2017 22:16
WireGuard 3.10.0-693.2.2.el7.x86_64 CentOS 7.4.1708 Error
[root@localhost ~]# dkms build -m wireguard -v 0.0.20170907
Kernel preparation unnecessary for this kernel. Skipping...
Building module:
cleaning build area...
make -j1 KERNELRELEASE=3.10.0-693.2.2.el7.x86_64 -C /lib/modules/3.10.0-693.2.2.el7.x86_64/build M=/var/lib/dkms/wireguard/0.0.20170907/build...(bad exit status: 2)
Error! Bad return status for module build on kernel: 3.10.0-693.2.2.el7.x86_64 (x86_64)
Consult /var/lib/dkms/wireguard/0.0.20170907/build/make.log for more information.
[root@localhost ~]# cat /var/lib/dkms/wireguard/0.0.20170907/build/make.log
@jdoss
jdoss / wireguard-monitor.path
Created April 15, 2018 16:38
Reload systemd-networkd on WireGuard config change
[Path]
PathChanged=/etc/systemd/network/wg0.network
PathChanged=/etc/systemd/network/wg0.netdev
[Install]
WantedBy=multi-user.target