Skip to content

Instantly share code, notes, and snippets.

View famousgarkin's full-sized avatar
🐐

Ján Dzurek famousgarkin

🐐
View GitHub Profile
@famousgarkin
famousgarkin / uninstall-all.sh
Last active March 17, 2017 13:25
uninstall Brew packages
brew remove --force --ignore-dependencies $(brew list)
@famousgarkin
famousgarkin / readme.md
Last active February 8, 2017 13:36
Jinja2 true/false/none literals

Note:

The special constants true, false, and none are indeed lowercase. Because that caused confusion in the past, (True used to expand to an undefined variable that was considered false), all three can now also be written in title case (True, False, and None). However, for consistency, (all Jinja identifiers are lowercase) you should use the lowercase versions.

http://jinja.pocoo.org/docs/2.9/templates/#literals

apt-get install --reinstall python-pkg-resources
@famousgarkin
famousgarkin / packer.json
Last active August 25, 2016 05:37
Packer Docer builder + Ansible remote provisioner setup
{
"builders": [
{
"type": "docker",
"image": "debian:7",
"run_command": ["-d", "-i", "-t", "--name", "default", "{{.Image}}", "/bin/bash"],
"commit": true
}
],
"provisioners": [
@famousgarkin
famousgarkin / perm-missing-elem.js
Created August 23, 2016 13:57
Codility - Lesson 3: Time Complexity - PermMissingElem (https://codility.com/programmers/task/perm_missing_elem/)
function solution(A) {
A.push(0)
return A.reduce(function(missing, value, i) {
return missing + i + 1 - value
}, 0)
}
var A = []
A[0] = 2
A[1] = 3
@famousgarkin
famousgarkin / frog-jmp.js
Created August 23, 2016 13:55
Codility - Lesson 3: Time Complexity - FrogJmp (https://codility.com/programmers/task/frog_jmp/)
function solution(X, Y, D) {
return Math.ceil((Y - X) / D)
}
var X = 10
var Y = 85
var D = 30
var test = solution(X, Y, D)
console.log(test, test === 3)
@famousgarkin
famousgarkin / tape-equilibrium.js
Last active August 23, 2016 13:48
Codility - Lesson 3: Time Complexity - TapeEquilibrium (https://codility.com/programmers/task/tape_equilibrium/)
function solution(A) {
var sum = A.reduce(function(sum, value) {
return sum + value
}, 0)
var sumLeft = 0
var min
for (var i = 1; i < A.length; i++) {
var value = A[i - 1]
sumLeft += value
var diff = Math.abs(2 * sumLeft - sum)
@famousgarkin
famousgarkin / inventory
Last active August 18, 2016 09:24
AWS EC2 host unreachable by public DNS name (ec2-xxx.compute.amazonaws.com)
[app]
app1 ansible_host=ec2-xxx.compute.amazonaws.com
@famousgarkin
famousgarkin / .travis.yml
Created August 17, 2016 09:23
Travis CI multiple orthogonal scripts/tests per project
+language: node_js
+node_js:
+ - 4.2
+ - 4
+ - 6
+env:
+ - SCRIPT='npm test'
+ - SCRIPT='npm run-script release'
+script: eval $SCRIPT