Skip to content

Instantly share code, notes, and snippets.

View gadelkareem's full-sized avatar
🎯
Focusing

Gadelkareem gadelkareem

🎯
Focusing
View GitHub Profile
---
- include_vars: secrets.yml
- apt: pkg=fuse state=absent
- apt: pkg={{ item }} state=present update_cache=yes
with_items:
- build-essential
- libcurl4-openssl-dev
- libxml2-dev
- mime-support
#!/bin/bash
# All credit goes to Marek Bosman.
# Source: https://marekbosman.com/site/automatic-update-of-cloudflare-ip-addresses-in-nginx/
# Location of the nginx config file that contains the CloudFlare IP addresses.
CF_NGINX_CONFIG="/etc/nginx/cloudflare"
# The URLs with the actual IP addresses used by CloudFlare.
CF_URL_IP4="https://www.cloudflare.com/ips-v4"
@peterhellberg
peterhellberg / api.go
Last active January 18, 2019 01:58
A tiny example API written in Go using Martini and Redigo
package main
import (
"flag"
"fmt"
"net/http"
"github.com/codegangsta/martini"
"github.com/garyburd/redigo/redis"
"github.com/martini-contrib/render"
@taupecat
taupecat / hover-state.scss
Created February 8, 2013 14:47
I'm tired of writing a { &:hover, &:active, &:focus { [blah blah blah] } } all the time in my SCSS. So I wrote a mixin. I can probably make this better. Later.
@mixin hover-state {
&:hover, &:active, &:focus {
@content;
}
}
a {
text-decoration: none;
@include hover-state {
1. No way of reusing task output in main play.
2. Cannot specify multiple fail_when statements.
3. [*] A play is atomic, i.e. I can't take the output from a command, parse its json then act on it. I need to create an intermediary fact containing the json dict then use that in another play. It's tedious.
4. If you're missing a variable in a variable file, Ansible won't fail to parse it. It will just tell you "VARIABLE IS NOT DEFINED!," which is ambiguous
5. Doing anything "complicated" (like looping within a loop for deeply nested Ansible variables) is right out.
6. selectattr doesn't actually do what you think it does!
7. Missing vars within tasks or roles can lead to very very VERY cryptic errors
8. So you can't set booleans with set_facts without casting......... https://github.com/ansible/ansible/issues/5463
9. It would be great if I could say something like:
@Roland09
Roland09 / TableCopyCellsDemo.java
Created February 11, 2015 18:07
Example about copying multiple selected table cells to the clipboard. Select the cells and press CTRL+C. The clipboard data can then be pasted into Excel, Notepad, etc. Copy works, Paste operation will be added in a separate gist.
import javafx.application.Application;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.SelectionMode;
import javafx.scene.control.TableColumn;
@madrobby
madrobby / gist:3202087
Created July 29, 2012 22:01
Fallback to PNG if SVG is not supported
<!-- example for the http://retinafy.me ebook -->
<style>
div.rss {
background: url(rss.svg);
width: 32px;
height: 32px;
}
body.no-svg div.rss {
sub vcl_hit {
if (obj.ttl >= 0s) {
# normal hit
return (deliver);
}
# We have no fresh fish. Lets look at the stale ones.
if (std.healthy(req.backend_hint)) {
# Backend is healthy. Limit age to 10s.
if (obj.ttl + 10s > 0s) {
set req.http.grace = "normal(limited)";
You can ssh into the VM by finding the IP (from kubectl config view) and using username "docker" password "tcuser":
ssh docker@192.168.XX.XX
@blaskovicz
blaskovicz / template.html
Created June 30, 2017 18:01
Golang template features (nested variables, range over array, index into map, conditionals)
<div class="levels">
{{ $groups := .LevelGroups }}
{{ $groupedLevels := .Levels }}
{{ $completeLevels := .CompleteLevels }}
{{ if $groupedLevels }}
{{ range $group := $groups }}
<div class="intro"><h2>{{$group}}</h2></div>
{{ range index $groupedLevels $group }}
<a href="/level/{{.Number}}" class="{{if index $completeLevels .Number}}complete{{end}}">
<span class="level">{{.Number}} </span>