Skip to content

Instantly share code, notes, and snippets.

View jamesmoriarty's full-sized avatar
🔮
0xc0000005

James Moriarty jamesmoriarty

🔮
0xc0000005
View GitHub Profile
set height 0
catch syscall close
catch syscall read
catch syscall lseek
disable 1 2
commands 2
disable 1 2
continue
@jamesmoriarty
jamesmoriarty / blackbox-exporter.yml
Last active October 25, 2019 05:49
Manifest with heredoc config.file on start.
command:
- /bin/sh
- -c
- |
cat << EOF > blackbox.yml && /bin/blackbox_exporter --config.file=blackbox.yml
modules:
http_2xx:
prober: http
http:
tls_config:
@jamesmoriarty
jamesmoriarty / install.sh
Last active October 11, 2019 00:18
Amazon Linux Workspace Basics - Microsoft Code, Google Cloud SDK, ...
#!/bin/sh
# cat /etc/os-release
# NAME="Amazon Linux"
# ...
sudo yum -y install git docker htop tree golang ruby
sudo systemctl enable docker
#!/bin/sh
# cat /etc/os-release
# NAME="Amazon Linux"
# ...
sudo yum -y install git docker htop tree golang ruby
sudo systemctl enable docker
#!/bin/sh
for arg in "job1" "job2"; do
(
echo $arg
) & pids+=($!)
done
wait "${pids[@]}"
/**
* const typeDefs: ITypeDefinitions = `
* scalar StringOrInt
* ...
* height: StringOrInt
* `
*/
const resolvers: IResolvers = {
StringOrInt: {
// graph hosts by source over time.
_sourceCategory=<source>
| timeslice 1m
| count_distinct(_sourceHost) group by _timeslice, _sourceCategory
| transpose row _timeslice column _sourceCategory
// nginx requests per second.
_sourceCategory=<source>
ffmpeg -r 60 -pattern_type glob -i '*.JPG' -s hd720 -vcodec libx264 -crf 18 -preset slow timelapse.mp4
# Filters
#
# https://ffmpeg.org/ffmpeg-filters.html#eq
#
# ffplay -vf eq=contrast=1.3:saturation=0.25 timelapse.mp4
const crypto = require('crypto');
const sha256 = s => crypto.createHash('sha256').update(s, 'utf8').digest('hex');
// sha256("test") => '9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08'
// sha256("abc") => 'ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad'
@jamesmoriarty
jamesmoriarty / deploy.rb
Created December 14, 2012 03:38
Sidekiq, Upstart, and Capistrano
namespace :deploy do
namespace :sidekiq do
desc 'Replace upstart config for sidekiq-workers'
task :upstart_config do
data = %Q{
start on runlevel [2345]
stop on runlevel [!2345]
respawn
exec su - #{user} -c 'cd #{release_path}; export RAILS_ENV=#{stage}; bundle exec sidekiq -q default,1 -c 4 -pid #{release_path}/tmp/pids/sidekiq.pid >> #{release_path}/log/sidekiq.log 2>&1'