Skip to content

Instantly share code, notes, and snippets.

View carlspring's full-sized avatar

Martin Todorov carlspring

View GitHub Profile
@skyzyx
skyzyx / homebrew-gnubin.md
Last active July 22, 2024 13:35
Using GNU command line tools in macOS instead of FreeBSD tools

macOS is a Unix, and not built on Linux.

I think most of us realize that macOS isn't a Linux OS, but what that also means is that instead of shipping with the GNU flavor of command line tools, it ships with the FreeBSD flavor. As such, writing shell scripts which can work across both platforms can sometimes be challenging.

Homebrew

Homebrew can be used to install the GNU versions of tools onto your Mac, but they are all prefixed with "g" by default.

All commands have been installed with the prefix "g". If you need to use these commands with their normal names, you can add a "gnubin" directory to your PATH from your bashrc.

@tuxfight3r
tuxfight3r / s3_upload.sh
Last active March 27, 2024 08:42
AWS - Upload files to S3 via curl
#!/bin/bash -x
#Date: 21/7/2017
#Author: Mohan
#Purpose: To upload files to AWS S3 via Curl
#Uploads file at the top level folder by default
#S3 parameters
S3KEY="XXXXXXXXXXX"
S3SECRET="XXXXXXXXXXXXXXXX"
@joelverhagen
joelverhagen / calls.txt
Created November 11, 2016 00:23
Variants of HTTP calls made by NuGet.exe list
[no Search()] nuget.exe list
[no Search()] nuget.exe list -allversions
[no Search(), no IsAbsoluteLatestVersion] nuget.exe list
[no Search(), no IsAbsoluteLatestVersion] nuget.exe list -allversions
GET /api/v2/Packages HTTP/1.1
GET /api/v2/Packages?$skip=100 HTTP/1.1
[no Search()] nuget.exe list -allversions -prerelease
[no Search(), no IsAbsoluteLatestVersion] nuget.exe list -allversions -prerelease
GET /api/v2/Packages()?$orderby=Id&$skip=0&$top=30 HTTP/1.1
@Faheetah
Faheetah / Jenkinsfile.groovy
Last active June 17, 2024 15:05
Jenkinsfile idiosynchrasies with escaping and quotes
node {
echo 'Results included as an inline comment exactly how they are returned as of Jenkins 2.121, with $BUILD_NUMBER = 1'
echo 'No quotes, pipeline command in single quotes'
sh 'echo $BUILD_NUMBER' // 1
echo 'Double quotes are silently dropped'
sh 'echo "$BUILD_NUMBER"' // 1
echo 'Even escaped with a single backslash they are dropped'
sh 'echo \"$BUILD_NUMBER\"' // 1
echo 'Using two backslashes, the quotes are preserved'
sh 'echo \\"$BUILD_NUMBER\\"' // "1"
@rmg
rmg / npm.md
Last active November 13, 2017 01:14
npm@3

npm install -g strongloop

This is a plain installation of the strongloop module in a fresh docker container with node-v0.10.39 (see Dockerfile or docker pull strongloop/strongbox:dev). The only difference between the 2 containers is the npm@3 container had npm install -g npm@3 run on it before these tests.

npm@2

strongbox@23e5cea0a3f1:~$ npm --version
2.11.3
strongbox@23e5cea0a3f1:~$ time npm install -g strongloop && du -sch /usr/local/lib/node_modules/strongloop
@rtfpessoa
rtfpessoa / java-8-ami.md
Last active March 21, 2022 14:46
[Guide] Install Oracle Java (JDK) 8 on Amazon EC2 Ami
@lttlrck
lttlrck / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@carlspring
carlspring / gist:6762356
Last active September 27, 2023 04:02
TeamCity REST API Commands
@jonjensen
jonjensen / rpmdb-compare
Created September 27, 2013 10:29
Script to compare installed RPMs between two servers using ssh and the rpm command.
#!/bin/sh
test -n "$TMPDIR" || TMPDIR=/tmp
tmpfilebase="$TMPDIR/rpmdb-compare.$$"
if test $# -ne 2
then
echo "Usage: $0 [user@]server1 [user@]server2" >&2
echo "Special name localhost means this server, without ssh" >&2
exit 1
@olamy
olamy / gist:2774179
Created May 23, 2012 09:18
maven session in a mojo
/**
* @parameter default-value="${session}"
* @readonly
* @required
*/
protected MavenSession session;