Skip to content

Instantly share code, notes, and snippets.

View aklinkert's full-sized avatar

Alex Klinkert aklinkert

  • Hamburg
View GitHub Profile
@stvnwrgs
stvnwrgs / pushb
Last active June 2, 2022 13:57
A small script to send push notifications to your phone when a job is done
#! /bin/bash
#################### Usage
#
# 1. Register an account on https://www.pushbullet.com/
# 2. Add devices
# 3. Create an access token https://www.pushbullet.com/#settings/account
# 4. save it to your bash profile $PUSHBULLET_API_TOKEN
# 5. Re-source, Execute the following (you can remove jq):
#
@daliborgogic
daliborgogic / delay.js
Created December 16, 2016 15:26
Node.js Async/Await delay
'use strict'
const timeout = ms => new Promise(res => setTimeout(res, ms))
function convinceMe (convince) {
let unixTime = Math.round(+new Date() / 1000)
console.log(`Delay ${convince} at ${unixTime}`)
}
async function delay () {
@achmadfatoni
achmadfatoni / slug-validation.php
Created September 8, 2016 03:36
Laravel slug validation
Validator::extend('slug', function($attribute, $value, $parameters, $validator) {
return preg_match('/^[a-z0-9]+(?:-[a-z0-9]+)*$/', $value);
});
@roylines
roylines / remote-terraform-s3-policy
Created September 19, 2015 10:46
IAM policy to allow storing of remote terraform state in S3
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:*"
],
"Resource": [
"arn:aws:s3:::my.bucket",
@RobertoSchneiders
RobertoSchneiders / deploy_with_ebcli3_on_circleci.md
Last active December 4, 2023 09:07
Settings to deploy to AWS Elastic Beanstalk on CircleCi (EB Cli 3)

This is how I configured the deploy of my rails apps to AWS Elastic Beanstalk through CircleCI 1.0.

If you are using the Circle CI 2.0, take a look at this article from ryansimms

Configure Environments Variables

On Project Settings > Environment Variables add this keys:

  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY
    The aws user must have the right permissions. This can be hard, maybe, this can help you.
#!/bin/bash
# Shamelessly stolen from https://gist.github.com/eduardocardoso/82a629882ddb02ab3677
set -o errexit
echo "Removing exited docker containers..."
docker ps -a -f status=exited -q | xargs -r docker rm -v
echo "Removing untagged images..."
docker images --no-trunc | grep "<none>" | awk '{print $3}' | xargs -r docker rmi
@zoellner
zoellner / ebextensions_loggly.config
Created March 26, 2014 02:46
Configure AWS Elastic Beanstalk to send syslog to loggly.com
#
# Install loggly.com on AWS Elastic Beanstalk
# Tested with node.js environment
# Save this file as .ebextensions/loggly.config
# Replace TOKEN and ACCOUNT with your own
# Deploy per normal scripts or aws.push.
#
commands:
01_loggly_dl:
@mikermcneil
mikermcneil / using-raw-socket-io-in-sails.js
Created September 17, 2013 18:32
Using raw socket.io functionality in a Sails.js controller
module.exports = {
/**
*
* Using raw socket.io functionality from a Sails.js controller
*
*/
index: function (req,res) {
@RichFromGalvanize
RichFromGalvanize / gist:5873044
Last active January 4, 2019 07:48
An image piping example using Node.js, express, and request...BOOYA!
var request = require('request');
var express = require('express');
var app = express();
app.get('/goofy', function(req, res) {
request('http://images1.wikia.nocookie.net/__cb20120715102950/disney/images/a/a5/Disneygoofy2012.jpeg').pipe(res);
});
app.get('/loop', function(req, res) {
res.render('mypage');
@benedict-w
benedict-w / iso_4217_currency_codes.php
Last active March 14, 2022 07:16
ISO 4217 currency codes as PHP array
<?php
// http://en.wikipedia.org/wiki/ISO_4217
return array(
'AFA' => array('Afghan Afghani', '971'),
'AWG' => array('Aruban Florin', '533'),
'AUD' => array('Australian Dollars', '036'),
'ARS' => array('Argentine Pes', '032'),
'AZN' => array('Azerbaijanian Manat', '944'),