Skip to content

Instantly share code, notes, and snippets.

@rquadling
rquadling / hipchat-v1.sh
Created August 24, 2017 15:33
Send an HTML message to HipChat using v1 of the api via cURL
MESSAGE="
<table><thead><tr><td colspan=\"2\"><b>Build starting</b></td></tr></thead>
<tbody>
<tr><td><b>Tag</b></td><td>${build_tag}</td></tr>
<tr><td><b>Built for</b></td><td>${built_for}</td></tr>
<tr><td><b>Built by</b></td><td>${built_by}</td></tr>
</tbody>
</table>
"
curl -s -X POST \
@ankurk91
ankurk91 / github_gpg_key.md
Last active April 14, 2025 13:42
Signing git commits using GPG (Ubuntu/Mac)

Github : Signing commits using GPG (Ubuntu/Mac) 🔐

  • Do you have an Github account ? If not create one.
  • Install required tools
  • Latest Git Client
  • gpg tools
# Ubuntu
sudo apt-get install gpa seahorse
# MacOS with https://brew.sh/
@ivanalejandro0
ivanalejandro0 / .eslintrc.yaml
Last active January 31, 2018 23:24
My ESLint configuration for Reactjs
---
parser: babel-eslint
parserOptions:
ecmaVersion: 6
sourceType: "module"
ecmaFeatures:
jsx: true
plugins:
- react
env:
@ivanalejandro0
ivanalejandro0 / pre-commit
Last active January 18, 2017 20:10
ESLint check your code as a pre-commit hook
#!/bin/bash
# based on: https://gist.github.com/linhmtran168/2286aeafe747e78f53bf
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep "\.jsx\{0,1\}$")
if [[ "$STAGED_FILES" = "" ]]; then
exit 0
fi
# Escape code
esc=`echo -en "\033"`
@ivanalejandro0
ivanalejandro0 / swapon.service
Created July 5, 2016 22:56
Swap service for CoreOS
# /etc/systemd/system/swapon.service
# from: https://www.matthowlett.com/notes/2015/08/01/coreos-swap.html
# sudo systemctl enable swapon.service
# restart
# or
# sudo systemctl start swapon
[Unit]
Description=Turn on swap
[Service]
@Faheetah
Faheetah / Jenkinsfile.groovy
Last active April 25, 2025 15:35
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"
@mikaelbr
mikaelbr / destructuring.js
Last active February 20, 2025 13:00
Complete collection of JavaScript destructuring. Runnable demos and slides about the same topic: http://git.mikaelb.net/presentations/bartjs/destructuring
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => [1, 2, 3];
@subudeepak
subudeepak / WebSockets.md
Last active December 4, 2024 13:36
The problems and some security implications of websockets - Cross-site WebSockets Scripting (XSWS)

WebSockets - An Introduction

WebSockets is a modern HTML5 standard which makes communication between client and server a lot more simpler than ever. We are all familiar with the technology of sockets. Sockets have been fundamental to network communication for a long time but usually the communication over the browser has been restricted. The general restrictions

  • The server used to have a permanent listener while the client (aka browser) was not designated any fixed listener for a more long term connection. Hence, every communication was restricted to the client demanding and the server responding.
  • This meant that unless the client requested for a particular resource, the server was unable to push such a resource to the client.
  • This was detrimental since the client is then forced to check with the server at regular intervals. This meant a lot of libraries focused on optimizing asynchronous calls and identifying the response of asynchronous calls. Notably t
@ivanalejandro0
ivanalejandro0 / .tmux.conf
Last active August 28, 2024 06:50
Tmux configuration file with Powerline-like status bar, system clipboard integration and some other nice tweaks.
# Install tpm + plugins with:
# git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
# trigger plugin install with: prefix + I
# trigger plugin update with: prefix + U
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'laktak/extrakto'
@philips
philips / gist:7310435
Last active March 17, 2017 21:03
Setting up swap on coreos

Setup a swap file in the stateful partition

Run these commands as root to create a 512 megabyte swap.

fallocate -l 512m /media/state/512MiB.swap
chmod 600 /media/state/512MiB.swap
mkswap /media/state/512MiB.swap