Skip to content

Instantly share code, notes, and snippets.

@mmattice
mmattice / gist:f4c0d628f56dabe18d86
Last active August 29, 2015 14:04
Grab a title from a webpage and turn it into ascii (if possible)
import re
from BeautifulSoup import BeautifulSoup
import requests
url = 'http://emojicons.com/e/flipping-tables'
r = requests.get(url)
soup = BeautifulSoup(r.text)
print soup.title.string.encode('ascii', 'ignore')
print re.search( '^.*?(?=::)', soup.title.string ).group()
@popsikle
popsikle / fleet unit file
Created February 18, 2015 22:20
CoreOS One APP_ENV to rule them all
[Unit]
Description=Crick API
After=docker.service
Requires=docker.service
[Service]
User=core
EnvironmentFile=/etc/environment
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker kill dev-crick-api-A-%i
@aauren
aauren / gist:2159881
Created March 22, 2012 17:10
Regex for Justin
echo "A Bug's Life (1990).mp4" | sed 's/\(.*\)\s([0-9]*)\..*/"\1"/'
With the extension:
echo "A Bug's Life (1990).mp4" | sed 's/\(.*\)\s([0-9]*)\.\(.*\)/"\1.\2"/'
Aaron's better way of creating the file:
echo "A Bug's Life (1990).mp4" | sed 's/\s([0-9]\+)//'
Aaron's better way of creating the folder:
echo "A Bug's Life (1990).mp4" | sed 's/\s([0-9]\+).*//'
# download latest libevent2 and tmux sources, and extract them somewhere
#
# at the time of writing:
# https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
# http://sourceforge.net/projects/tmux/files/latest/download?source=files
#
# don't compile tools as root, just don't do it.
# install deps
@jlsherrill
jlsherrill / fix_duplicate_nvreas.md
Last active February 22, 2016 20:42
Remove duplicate rpms within a repo

Fix for https://pulp.plan.io/issues/494

yum install pulp-admin-client pulp-rpm-admin-extensions
  1. update /etc/pulp/admin/admin.conf set 'varify_ssl to 'False'
@solar
solar / zsh-5.0.0.sh
Created October 12, 2012 05:00
Install zsh 5.0.0 on CentOS/RH 6.3
# install zsh-5.0.0
# prerequisite: gcc ncurses-devel readline-devel pcre-devel zlib-devel
curl -L http://jaist.dl.sourceforge.net/project/zsh/zsh/5.0.0/zsh-5.0.0.tar.bz2 | tar jx
cd zsh-5.0.0/
./configure --prefix=/usr/local/zsh/5.0.0 --enable-cap --enable-pcre --enable-multibyte
make
sudo make install
sudo alternatives --install /usr/local/bin/zsh zsh /usr/local/zsh/5.0.0/bin/zsh 50000
---
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: {{.Chart.Name}}
spec:
serviceName: {{.Chart.Name}}-headless
replicas: {{.Values.vault.replicas}}
template:
metadata:
#!/bin/bash
e=`echo '' | dmenu -p Emoji:` && curl -G https://api.getdango.com/api/emoji --data-urlencode "q=$e" | jq '.results[].text' -r | xclip -sel clip
@dw
dw / step1.sh
Last active September 27, 2017 03:51
Ansiblol
ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/Users/dmw/.ansible/cp/4e8d7ac1b9 u
'/bin/sh -c '"'"'echo ~ && sleep 0'"'"''
#!/usr/bin/python
#-*- coding: UTF-8 -*-
import os, time
import usb.core
import usb.util
import pygtk
pygtk.require('2.0')
import gtk
from sys import exit