Skip to content

Instantly share code, notes, and snippets.

View ksclarke's full-sized avatar
🥑
Perpetual rambler, rarely at ease

Kevin S. Clarke ksclarke

🥑
Perpetual rambler, rarely at ease
View GitHub Profile
@nz
nz / Delete all documents in a Solr index using curl.md
Last active February 12, 2024 10:55
Delete all documents in a Solr index using curl
# http://wiki.apache.org/solr/FAQ#How_can_I_delete_all_documents_from_my_index.3F
# http://wiki.apache.org/solr/UpdateXmlMessages#Updating_a_Data_Record_via_curl

curl "http://index.websolr.com/solr/a0b1c2d3/update?commit=true" -H "Content-Type: text/xml" --data-binary '<delete><query>*:*</query></delete>'

I'm amused at the traction this little gist is getting on Google! I would be remiss not to point out that six+ years later I'm still helping thousands of companies on a daily basis with their search index management, by providing managed Solr as a service over at Websolr, and hosted Elasticsearch at Bonsai. Check us out if you'd like an expert helping hand at Solr and Elasticsearch hosting, ops and support!

@dfox
dfox / update-route53-dns.sh
Created January 25, 2012 17:19
A script to update DNS on Route 53
#!/bin/sh
# Make sure only root can run our script
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
# Load configuration
. /etc/route53/config
@yincrash
yincrash / Google2APi.java
Created April 22, 2012 17:22
Google OAuth2.0 for scribe-java
package org.scribe.builder.api;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.scribe.exceptions.OAuthException;
import org.scribe.extractors.AccessTokenExtractor;
import org.scribe.model.OAuthConfig;
import org.scribe.model.OAuthConstants;
import org.scribe.model.OAuthRequest;
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@eriwen
eriwen / pre-commit
Last active January 13, 2021 08:22
Pre-commit git hook for tracking new TODO/FIXME comments
#!/usr/bin/ruby
$refname = ARGV[0]
$oldrev = ARGV[1]
$newrev = ARGV[2]
def tasks
puts 'Checking TODOs...'
todo_pattern = /^\s*\+\s*([\/\#]+|<\!\-\-)\s*(FIXME|TODO)\W*([\s\w]+)(\-\->)?$/
# Find task-oriented comments added with this commit
@edsu
edsu / robots.py
Last active August 29, 2015 14:02
A demonstration of how Google (and other indexing robots) are unable to crawl The American Archivist. The American Archivist is the journal of the Society of American Archivists, and is "freely available to the public, with the exception of full-text articles from the three most recent volumes".
>>> import robotparser
>>> rp = robotparser.RobotFileParser('http://archivists.metapress.com/robots.txt')
>>> rp.read()
>>> rp.can_fetch('Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)', '/content/953m4u0116t20624/?p=bf20338aa6ef4bc0a60dac3f2c38a6bd&pi=2')
False
@jmiserez
jmiserez / export_google_music.js
Last active December 20, 2023 01:45
(fixed/updated 2016-05-10) Export your Google Music Library and Playlists (Google Play Music All Access) (see http://webapps.stackexchange.com/questions/50311/print-playlist-from-google-play-music for more)
// Copyright 2016 Jeremie Miserez <jeremie@miserez.org>
//
// MIT License
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF O
#!/bin/bash
# Got most of this from http://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_cloudwatch_logs.html
# and https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_awslogs.html
# Install awslogs and the jq JSON parser
yum install -y awslogs jq aws-cli nfs-utils
# ECS config
# ECS_AVAILABLE_LOGGING_DRIVERS is needed if you're not using the ECS optimized ami
{
@amitasaurus
amitasaurus / pre-commit.txt
Last active April 11, 2020 02:40
Custom pre commit git hook to check for FIXME
The hooks are all stored in the hooks subdirectory of the Git directory that’s .git/hooks
Open your terminal or powershell for windows;
Navigate to $ cd /path-to-your-git-repo/.git/hooks
$ touch pre-commit
$ cp pre-commit.sample pre-commit
$ chmod +x pre-commit
Open the pre-commit script and start the real scripting with your text editor
$ open -e pre-commit
add this
@sualeh
sualeh / how_to_sign_and_release_to_the_central_repository_with_github_actions.md
Last active June 8, 2024 17:46
How to Sign and Release to The Central Repository with GitHub Actions

How to Sign and Release to The Central Repository with GitHub Actions

GitHub allows automated builds using GitHub Actions. A commonly asked question is how to release artifacts (packaged Java jars) built by Maven and Gradle to The Central Repository. The GitHub Actions documentation provides only part of the answer.

So, first, configure your Maven project for staging artifacts to The Central Repository, by reading through Configuring Your Project for Deployment and following those steps. Please make sure that the maven-gpg-plugin is configured to prevent gpg from using PIN entry programs, as follows:

<configuration>
  <gpgArguments>
      <arg>--pinentry-mode</arg>
 loopback