Skip to content

Instantly share code, notes, and snippets.

Lars Preben Sørsdahl larsar

Block or report user

Report or block larsar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@larsar
larsar / gen_formatted_codes.sh
Created Feb 12, 2019
Generate unique invite codes formatted for print
View gen_formatted_codes.sh
python3 gen_invite_codes.py > all_codes.csv
sed 's/\([[:digit:]][[:digit:]][[:digit:]]\)\([[:digit:]][[:digit:]][[:digit:]]\)\([[:digit:]][[:digit:]][[:digit:]]\)/\1-\2-\3/' all_codes.csv > formatted_codes.csv
@larsar
larsar / delete_es_snapshots.sh
Created Sep 7, 2017
Delete Elasticsearch snapshots for a date range
View delete_es_snapshots.sh
#!/usr/bin/env bash
d=2016-02-14
while [ "$d" != 2016-03-01 ]; do
curl -X DELETE http://<HOST>/_snapshot/<INDEX>/snapshot-`echo $d | tr - .` -H 'content-type: application/json'
d=$(date -I -d "$d + 1 day")
done
@larsar
larsar / keybase.md
Created Mar 20, 2017
Keybase verification
View keybase.md

Keybase proof

I hereby claim:

  • I am larsar on github.
  • I am larsar (https://keybase.io/larsar) on keybase.
  • I have a public key ASBKn12pNjd5t6lYKZARkU8atBVOYGr-22tU43Nu5RUtfgo

To claim this, I am signing this object:

@larsar
larsar / fetch_repo_urls.sh
Created Oct 4, 2016
Simple script for retrieving all rep URLs from Bitbucket Server
View fetch_repo_urls.sh
#!/usr/bin/env bash
URL="https://<HOST>/rest/api/1.0/projects"
>&2 printf "Enter Bitbucket Server credentials\n"
>&2 printf "Username: "
read username
>&2 printf "Password: "
read -s password
@larsar
larsar / fetch_repo_urls.sh
Created Oct 4, 2016
Simple script for retrieving all rep URLs from Bitbucket Server
View fetch_repo_urls.sh
#!/usr/bin/env bash
URL="https://<HOST>/rest/api/1.0/projects"
>&2 printf "Enter Bitbucket Server credentials\n"
>&2 printf "Username: "
read username
>&2 printf "Password: "
read -s password
@larsar
larsar / test_mail_server_auth.sh
Created Apr 26, 2016
Check user authentication with SMTP
View test_mail_server_auth.sh
#!/usr/bin/env bash
[[ $@ ]] || {
printf "Usage\n\t./$0 server username password\n"
exit 1
}
SERVER=$1
MAILUSER=$2
PASSWORD=$3
View testscript.js
/* global _ */
/*
* Complex scripted Logstash dashboard
* This script generates a dashboard object that Kibana can load. It also takes a number of user
* supplied URL parameters, none are required:
*
* index :: Which index to search? If this is specified, interval is set to 'none'
* pattern :: Does nothing if index is specified. Set a timestamped index pattern. Default: [logstash-]YYYY.MM.DD
@larsar
larsar / gist:bc43b7f508b87fe8a9e1
Created Jun 7, 2014
Regex for replacing global variable with let in specs in RubyMine.
View gist:bc43b7f508b87fe8a9e1
Search: @(\S*)\s=
Replace: let(:$1) {
View char_converter.rb
# config/initializers/char_converter.rb
require 'uri'
module Support
class CharConverter
SANITIZE_ENV_KEYS = [
"HTTP_COOKIE", # bad cookie encodings kill rack: https://github.com/rack/rack/issues/225
"HTTP_REFERER",
"PATH_INFO",
View char_converter.rb
# config/initializers/char_converter.rb
require 'uri'
module Support
class CharConverter
def initialize(app)
@app = app
end
You can’t perform that action at this time.