Skip to content

Instantly share code, notes, and snippets.

View jesusaurus's full-sized avatar

Joni Harker jesusaurus

  • Earth
View GitHub Profile
@jesusaurus
jesusaurus / nowake.sh
Created January 17, 2022 20:20
Prevent immediate resume-from-suspend
#!/bin/sh
# disable all acpi wakeups except the power button
cat /proc/acpi/wakeup | grep enabled | grep -v PWRB |
while read dev foo
do
echo $dev > /proc/acpi/wakeup
done
@jesusaurus
jesusaurus / hope-dump.sh
Last active July 28, 2016 18:25 — forked from haxwithaxe/hope-dump.sh
download all the things
#!/bin/bash
URL_BASE="http://livestream.com/internetsociety" #"/hopeconf"
VIDEO_TYPE="progressive_url"
dump_track(){
wget -O - "http://livestream.com/internetsociety${1}/hopeconf" 2>/dev/null| sed 's/","/",\n"/g' | grep $VIDEO_TYPE | grep -v smil | sed 's/[",]\+$//;s/.*"//' | grep http
}
for url in $(dump_track | tee lamarr); do
#/bin/bash
# vim: tabstop=2:softtabstop=2:shiftwidth=2:noexpandtab
#
# Authored by Yazz D. Atlas <yazz.atlas@hp.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
@jesusaurus
jesusaurus / id_ecdsa.pub
Last active August 29, 2015 13:56
jesusaurus@avalon
ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBADfkf+IoIighmFoYFaCQopaOQyRoE0B5eiJ6gKLUbJdTxxaxAq8y1bIj2XWAk8Uy/uqWUdOVAvcOkwUGBMBH5YZRAFcMNZk5QbUOSpZyC2sr0yKxZsshjqnUyZIifIQp1ydwE73N8CkH+FhKIGyeNE/x3jI7xXsePNoL/H2GKNzri0peA== jesusaurus@avalon
@jesusaurus
jesusaurus / git_purge.sh
Created February 25, 2014 19:42
purge file from git
#!/bin/bash
set -o errexit
# Author: David Underhill
# Script to permanently delete files/folders from your git repository. To use
# it, cd to your repository's root and then run the script with a list of paths
# you want to delete, e.g., git-purge path1 path2
if [ $# -eq 0 ]; then
exit 0
@jesusaurus
jesusaurus / auth.py
Created December 17, 2013 17:46
Test hpcloud auth
import restclient
import json
import os
class ident(object):
def __init__(self, region_url, debug=False):
self.debug = debug
self.connect(url=region_url)
def __enter__(self):
@jesusaurus
jesusaurus / migrate.py
Created May 14, 2013 23:32
elasticsearch migration
import requests
import logging
logging.basicConfig(format='%(asctime)s\t%(name)-16s %(levelname)-8s %(message)s')
#very noisy library
requests_log = logging.getLogger("requests")
requests_log.setLevel(logging.WARNING)
logger = logging.getLogger('es_migrate')
@jesusaurus
jesusaurus / install-salt.sh
Created April 26, 2013 23:28
Install salt-master to run under a service user
#!/bin/bash
$SALT_HOME=/var/local/salt
sudo useradd -m -d $SALT_HOME -r -U -c "Salt Master Daemon" salt
mkdir salt
cat > salt/master <<EOF
user: salt
@jesusaurus
jesusaurus / apache_proxy.sls
Created April 23, 2013 23:16
UndefinedError: 'pillar' is undefined
{% macro proxy(site, server, port, http=True, https=False) -%}
extend:
{{ pillar['package']['apache'] }}:
service:
- watch:
- file: /etc/{{ pillar['package']['apache'] }}/sites-enabled/{{ site }}
/etc/{{ pillar['package']['apache'] }}/sites-enabled/{{ site }}:
file.managed:
@jesusaurus
jesusaurus / myscript.sh
Last active December 6, 2019 08:19
Redirect a bash script's output and error to syslog
#!/usr/bin/env bash
# The pattern `exec > $X 2>&1` does two things: the last bit redirects standard
# error to go to standard output, and the first bit sends standard output to the
# file $X. Here our $X is the process substitution `>( $process )` which takes
# the standard input of $process and presents it as a file handle. Putting
# these two together, we have both our standard out and our standard error
# going to the standard input of $process. Our $process here first runs tee,
# which sends its standard input to both standard out and to the file listed.
# We then pipe our standard out into the logger command, which sends it to syslog.