Skip to content

Instantly share code, notes, and snippets.

View ralph-tice's full-sized avatar

Ralph Tice ralph-tice

  • Kentik
  • Texas
View GitHub Profile
@ralph-tice
ralph-tice / gist:5993238
Created July 14, 2013 04:42
given the context of a tweet on twitter that has a pic.twitter.com image this is how you get the actual url to the picture... or is it ? Do I just suck at filtering?
//v1, works, normally .each instead of [0]
$($($('a:contains("pic.twitter.com/")')[0]).parent().parent().parent().data('expandedFooter')).children(".cards-media-container").children().children(".media").children("a").data('url')
//v2, found 'find' instead of 'filter'...
$($($('a:contains("pic.twitter.com/")')[0]).parent().parent().parent().data('expandedFooter')).find("a.media-thumbnail").data('url')
@ralph-tice
ralph-tice / gist:6310571
Created August 22, 2013 17:55
ISCABBS rant on autocruft.
Jun 4, 2007 12:38 from John Public
WORF> You just stepped in the worst pile of GNU horseshit ever to be barfed
all over the *nix world: autocruft.
The idea is this. You write your app in C. It's 99% portable. However,
different unixes have slightly different C functions, or are missing them. You
could easily workaround this with two lines of preprocessor #ifdefs, or just a
contrib/ directory for patches. Instead, you write some M4 macros to fuss with
some C headers to patch your code. Now your code is 99.1% portable. However,
different unixes have slightly different m4 variants. Damn. Now you need to
@ralph-tice
ralph-tice / backup_solr_cloud.sh
Last active December 22, 2015 18:18
backup solr cloud v2 courtesy of elyograg @ #solr
#!/bin/bash
# Defaults. Override in /etc/default/solr-backup.
# Unprivileged user/group that we will use to run this script.
B_USR=ubuntu
B_GRP=${B_USR}
# Domain SUFFIX.
SUFFIX=.dnsxSUFFIX.yourhost.com
@ralph-tice
ralph-tice / rsyslog.conf
Last active December 22, 2015 22:59
rsyslog testing
#!/usr/bin/perl
use Sys::Syslog qw( :DEFAULT setlogsock );
setlogsock('unix');
openlog('apache', 'cons', 'pid', 'local2');
while ($log = <STDIN>) {
syslog('notice', $log);
}
closelog
@ralph-tice
ralph-tice / gist:7139341
Last active September 28, 2017 19:15
version control jenkins and jobs this shell snippet itself can be used as a jenkins job and it will add itself.
cd /var/lib/jenkins
git add userContent/* -f
git add jobs/*/*.xml -f
git add users/*/config.xml -f
git add *.xml
COUNT=`git ls-files --deleted | wc -l`
if [ $COUNT -ne 0 ]
then git ls-files --deleted | xargs -d '\n' git rm
@ralph-tice
ralph-tice / i2.2xlarge #1
Last active January 2, 2016 16:19
unixbench i2.2xlarge bonnie++ output
========================================================================
BYTE UNIX Benchmarks (Version 5.1.3)
System: machine1.com: GNU/Linux
OS: GNU/Linux -- 3.8.0-35-generic -- #50~precise1-Ubuntu SMP Wed Dec 4 17:25:51 UTC 2013
Machine: x86_64 (x86_64)
Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8")
CPU 0: Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz (5000.1 bogomips)
Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET
CPU 1: Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz (5000.1 bogomips)
@ralph-tice
ralph-tice / gist:c2943aa672aaa65ecb59
Last active May 16, 2017 02:30
PostgreSQL settings to aggressively vacuum, this config was used for an 18000 TPS steadystate workload on i2.xlarge
#------------------------------------------------------------------------------
# AUTOVACUUM PARAMETERS
#------------------------------------------------------------------------------
#autovacuum = on # Enable autovacuum subprocess? 'on'
# requires track_counts to also be on.
log_autovacuum_min_duration = 0 # -1 disables, 0 logs all actions and
# their durations, > 0 logs only
# actions running at least this number
# of milliseconds.
@ralph-tice
ralph-tice / gist:458d765cdb9a35bf3dfd
Last active February 13, 2024 18:21
Cloud RAM pricing

AWS u-24tb1.112xlarge:

  • 448 vCPUs
  • 24576 GiB RAM
  • 3 year reservation all upfront cost: $1.65M
  • Monthly effective rate: $44,585
  • $1.81 per GB per month
  • Additional discounts for volume (5% >250K, 10% > $2M)
  • Source updated 2/13/2024

GCE m3-ultramem-128:

-verbose:gc \
-XX:+PrintGCDetails \
-XX:+PrintGCDateStamps \
-XX:+PrintGCTimeStamps \
-XX:+PrintHeapAtGC \
-XX:+PrintTenuringDistribution \
-XX:+PrintGCApplicationStoppedTime \
-XX:+PrintGCApplicationConcurrentTime \
-XX:+UseGCLogFileRotation \
-XX:NumberOfGCLogFiles=5 \
@ralph-tice
ralph-tice / .bashrc or .bash_profile
Last active August 29, 2015 14:06
Connecting to an EC2 instance in a oneliner
sshto() {
ssh ubuntu@`knife ec2 server list | grep $1 | awk '{print $3}'`
}
# ex usage: sshto i-12341234