Skip to content

Instantly share code, notes, and snippets.

@manuzhang
manuzhang / sbt_china_mirror
Last active March 21, 2020 06:46
sbt China mirror
[repositories]
local
oschina: http://maven.oschina.net/content/groups/public/
oschina-ivy: http://maven.oschina.net/content/groups/public/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
typesafe: http://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly
#sonatype-oss-releases
#maven-central
#sonatype-oss-snapshots
@ryanmaclean
ryanmaclean / accept_xcode_license.sh
Last active November 22, 2023 18:26
Accept Xcode License on the Command Line
# Run using "sudo accept_xcode_license.sh"
#
# Solving the OSX Yosemite Xcode Command Line Tools Licensing problem
# for multiple updates in order to script post-install tasks.
# Typical error reads after running "xcode-select --install" when setting up
# Homebrew is: "Agreeing to the Xcode/iOS license requires admin priviledges,
# please re-run as root via sudo"
#
# CREDIT:
# Based on a tip found at http://krypted.com/mac-os-x/licensing-the-xcode-command-line-tools/
@wsargent
wsargent / docker_cheat.md
Last active August 31, 2023 12:10
Docker cheat sheet
@chloerei
chloerei / jekyll_image_fetcher.rb
Last active December 24, 2015 05:19
Fetch images and replace link in markdown posts.
# = Usage
# Download to your jekyll site directory, and run it
# `ruby jekyll_image_fetcher.rb`
Dir['_posts/*.md'].each do |path|
content = File.open(path).read
basename = File.basename path, '.md'
content.gsub!(/!\[\]\((.+)\)/) do |m|
url = $1
@genewoo
genewoo / gitlab_ldap.sh
Created April 28, 2013 07:19
Login LDAP Authentication GitLab instance by CLI and Fetch RAW File by curl. Since LDAP authentication will create the account for you, so it's very useful to fetch file from GitLab.
#!/bin/sh
BASEURL=http://git
USERNAME=DOMAIN_USER
USERPASS=DOMAIN_PASSWORD
RAW_FILE=RAW_FILE_URI
# login
curl -s -c cookies.txt -d "username=$USERNAME&password=$USERPASS" $BASEURL/users/auth/ldap/callback -o /dev/null
curl -s -c cookies.txt -b cookies.txt $BASEURL$RAW_FILE
@DiogoAndre
DiogoAndre / ping.rb
Last active January 3, 2024 09:08
Simple ICMP Ping script in Ruby. Using the Net-Ping gem https://github.com/djberg96/net-ping
require 'net/ping'
@icmp = Net::Ping::ICMP.new('142.40.81.34')
rtary = []
pingfails = 0
repeat = 5
puts 'starting to ping'
(1..repeat).each do
if @icmp.ping
@jpinnix
jpinnix / gist:3186304
Created July 27, 2012 05:25
Installing Ruby 1.8.7-p358 with rbenv on Mountain Lion
Follow the instructions here: The Hitchhiker's Guide to Riding a
Mountain Lion http://j.mp/Qm5UJD, including installing XQuartz.
After installing XQuartz set the correct path to the X11 library to
install Ruby 1.8.7-p358 with rbenv:
export CPPFLAGS=-I/opt/X11/include
then let the compiler know where gcc-4.2 is:
@lanwin
lanwin / add_users_to_projects.sh
Created February 2, 2012 08:41
Script to Automatically add all GitLab users to all projects
#!/bin/sh
baseurl=http://mygitlaburl
usermail=adminuser@mymailserver
userpass=adminpassword
repo_access=2 #0=denied 1=read 2=read&write
project_access=2 #0=deined 1=read 2=report 3=admin
# login
curl -s -I -c cookies.txt -d "utf8=✓&user[email]=$usermail&user[password]=$userpass&commit=Sign+in" $baseurl/users/sign_in
@ralfebert
ralfebert / gist:1255969
Created October 1, 2011 12:17
Ruby String helpers: indent, to_javadoc, markdown, pygmentize
# Placed in Public Domain by Ralf Ebert, 2008
#
# THIS SOFTWARE IS PROVIDED BY Ralf Ebert ''AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL Ralf Ebert BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
@lusis
lusis / irbrc.rb
Created January 26, 2011 16:07
Add this to disable irb echo
# via http://tagaholic.me/2009/05/29/exploring-how-to-configure-irb.html#echo
def irb_verbosity_toggle
irb_context.echo ? irb_context.echo = false : irb_context.echo = true
end