Skip to content

Instantly share code, notes, and snippets.

# curl -o ~/.oh-my-zsh/custom/themes/akofink.zsh-theme https://gist.github.com/akofink/3c9dbb65826eeb632a5250ce38a5fb8e/raw/1cdd0136aa2e866da763d62d913e898103cb4d43/akofink.zsh-theme
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[green]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}⚡"
ZSH_THEME_GIT_PROMPT_CLEAN=""
function prompt_char {
if [ $UID -eq 0 ]; then echo "%{$fg[red]%}#%{$reset_color%}"; else echo $; fi
}
@jzelinskie
jzelinskie / config
Last active January 18, 2024 19:23
generate a knot-resolver (kresd) blacklist.rpz from pihole sources
-- Refer to manual: https://knot-resolver.readthedocs.io/en/latest/daemon.html#configuration
-- Listen on all interfaces (localhost would not work in Docker)
net.listen('0.0.0.0')
net.listen('0.0.0.0', 853, {tls=true})
-- Auto-maintain root TA
trust_anchors.file = '/data/root.keys'
-- Load Useful modules
@johnpmitsch
johnpmitsch / servers.sh
Last active June 11, 2019 15:40
Katello - kill rails and webpack functions
function kill_servers {
# kill node server
kill -9 $(ss -tulpn | grep 3808 | awk '{ print $7}' | awk -F'[=|,]' '{ print $3 }') 2> /dev/null
#kill rails server
if [ -f /home/vagrant/foreman/tmp/pids/server.pid ]; then
kill -9 $(cat /home/vagrant/foreman/tmp/pids/server.pid)
fi
}

in config/settings.yaml :webpack_dev_server: true

In one tab:

rails s -b '0.0.0.0'

In a 2nd tab:

@acolyer
acolyer / jessfraz.md
Created November 19, 2017 13:39
Containers, operating systems and other fun things from The Morning Paper
@johnpmitsch
johnpmitsch / virt-who.md
Last active November 16, 2018 20:59
virt-who installation for katello (to get hypervisor guests)

On hypervisor (probably your workstation)

  1. yum install virt-who

  2. Edit /etc/virt-who.d/test.conf and update the rhsm_hostname, rhsm_username, rhsm_password (use dev server credentials)

[libvirt]
type=libvirt
server=qemu:///system
owner=Default_Organization
env=Library
@johnpmitsch
johnpmitsch / mass-resync.rb
Last active January 10, 2017 00:20
re-sync all repos in hammer
#!/usr/bin/ruby
password=(ARGV[0] || "changme")
orgs=`hammer -p changeme --csv organization list | tail -n+2 | awk -F, {'print $1'}`
orgs.split("\n").each do |org|
`hammer -p changeme --csv repository list --organization-id #{org} | grep -vi '^ID' | awk -F, {'print $1'}`.split("\n").each do |repo|
`hammer -p changeme repository synchronize --id #{repo} --organization-id #{org} --async`
end
end
@johnpmitsch
johnpmitsch / generate-hosts.rb
Last active June 25, 2018 14:47
proxy generate virt hosts apache
#!/usr/bin/env ruby
base=50000 #port
range="192.168.121."
contents = <<-EOS
Listen %{port} https
<VirtualHost *:%{port}>
ProxyPass / https://%{ip_address}/
<Location />
@vancluever
vancluever / gnome-tracker-disable.md
Last active May 2, 2024 16:26
GNOME Tracker Disable

Disabling GNOME Tracker and Other Info

GNOME's tracker is a CPU and privacy hog. There's a pretty good case as to why it's neither useful nor necessary here: http://lduros.net/posts/tracker-sucks-thanks-tracker/

After discovering it chowing 2 cores, I decided to go about disabling it.

Directories

@pixeltrix
pixeltrix / time_vs_datatime.md
Last active February 18, 2024 19:20
When should you use DateTime and when should you use Time?

When should you use DateTime and when should you use Time?

It's a common misconception that [William Shakespeare][1] and [Miguel de Cervantes][2] died on the same day in history - so much so that UNESCO named April 23 as [World Book Day because of this fact][3]. However because England hadn't yet adopted [Gregorian Calendar Reform][4] (and wouldn't until [1752][5]) their deaths are actually 10 days apart. Since Ruby's Time class implements a [proleptic Gregorian calendar][6] and has no concept of calendar reform then there's no way to express this. This is where DateTime steps in:

>> shakespeare = DateTime.iso8601('1616-04-23', Date::ENGLAND)
=> Tue, 23 Apr 1616 00:00:00 +0000
>> cervantes = DateTime.iso8601('1616-04-23', Date::ITALY)
=> Sat, 23 Apr 1616 00:00:00 +0000