Skip to content

Instantly share code, notes, and snippets.

View udondan's full-sized avatar
🤠

Daniel Schroeder udondan

🤠
View GitHub Profile
@mattwhite
mattwhite / build-bash-lenny.sh
Last active August 29, 2015 14:06
Compile Bash 3.2 from source for Debian Lenny to patch the shellshock vulnerabilities (CVE-2014-6271, CVE-2014-7169, CVE-2014-6277, CVE-2014-6278, CVE-2014-7186, CVE-2014-7187)
# inspired by http://askubuntu.com/a/528171 and the comments below
# build bash 3.2, though this should work for other versions as well
BASH_MAJOR=3
BASH_MINOR=2
# prerequisites
sudo apt-get install build-essential gettext bison
# get bash source
@peternixey
peternixey / ga_last_x_days.js
Created June 28, 2012 11:24
Google Analytics bookmark to show just the last X days of data
javascript: function analyticsURL(){ var properties = { profileID: 'EDIT__YOUR_ANALYTICS_REPORT_ID', daysToShow: EDIT__NUMBER_OF_DAYS_TO_SHOW,includeToday: EDIT__INCLUDE_TODAY_TRUE_OR_FALSE, report_url: 'EDIT__URL_OF_REPORT_YOU_WANT_TO_SHOW' }; function stringify(date){ return date.getFullYear().toString() + pad(date.getMonth() + 1) + pad(date.getDate()); }; function pad(numeral){ return numeral<10 ? '0' + numeral.toString() : numeral.toString(); }; void(properties.report_url = properties.report_url.replace(/([^/])$/, '$1/')); var endDate = new Date(); var startDate = new Date(); properties.includeToday ? false : endDate.setDate( endDate.getDate()-1 ); startDate.setDate( endDate.getDate() - properties.daysToShow + 1 ); return properties.report_url + properties.profileID + '/%3F_.date00%3D' + stringify(startDate) + '%26_.date01%3D' + stringify(endDate) + '/'; }; window.location = analyticsURL();
// INSTRUCTIONS
// 1. In the URL above, change the following four variables at the s
#!/bin/sh
#
# redis - this script starts and stops the redis-server daemon
#
# chkconfig: - 85 15
# description: Redis is a persistent key-value database
# processname: redis-server
# config: /etc/redis/redis.conf
# config: /etc/sysconfig/redis
# pidfile: /var/run/redis/redis.pid
@reywood
reywood / meteor-init-script
Last active July 27, 2017 18:05
SysVinit boot script for running a bundled Meteor app under Forever as a service. Should work with CentOS, Redhat, Amazon Linux, etc.
#!/bin/bash
#
# Service script for running a bundled Meteor application under Forever.
# Meteor settings JSON file should be in /etc/meteor/[YOUR APP NAME].json,
# and the METEOR_SETTINGS var below should be updated as appropriate.
#
# chkconfig: 345 80 20
# description: My node app
#
import UIKit
import QuartzCore
class ViewController: UIViewController {
@IBOutlet weak var label: UILabel
@IBOutlet weak var counter: UILabel
override func viewDidLoad() {
super.viewDidLoad()
@hareeqi
hareeqi / change_swagger_host.js
Last active December 13, 2018 14:29
dynamic host for swagger ui 3.x
// not the most elgant way but it works
// in the console post the function below and call changeSwagger("http","localhost:5050","/my_path/)
function changeSwagger (scheme,host,path) {
var newspec = ui.spec().toJSON().resolved
newspec.scheme = [scheme] || newspec.scheme
newspec.host = host || newspec.host
newspec.basePath = path || newspec.basePath
ui.getStore().dispatch({type:'set_scheme',payload: {scheme: newspec.scheme[0]}})
@BryanSchuetz
BryanSchuetz / concat.liquid
Created May 5, 2016 16:20
Concat arrays in Jekyll(liquid)
{% assign all_hosts = "" | split: "" %}
{% for host in site.data.shared_hosts %}
{% assign all_hosts = all_hosts | push: host %}
{% endfor %}
{% for host in site.data.paas_hosts %}
{% assign all_hosts = all_hosts | push: host %}
{% endfor %}
package main
import (
"log"
"net"
)
func main() {
var status string
conn, err := net.Dial("tcp", "127.0.0.1:80")
@Inferis
Inferis / ViewController.swift
Last active December 1, 2019 23:27
Beginnings of a GCD wrapper in swift
import UIKit
import QuartzCore
class ViewController: UIViewController {
@IBOutlet weak var label: UILabel
@IBOutlet weak var counter: UILabel
override func viewDidLoad() {
super.viewDidLoad()
@lestephane
lestephane / Dockerfile
Created September 10, 2017 19:35
Dockerized terraform bundler
FROM golang:alpine
RUN apk update && apk upgrade && \
apk add --no-cache git zip
ARG TERRAFORM_VERSION
RUN git clone --single-branch --branch v${TERRAFORM_VERSION} https://github.com/hashicorp/terraform.git /go/src/github.com/hashicorp/terraform
RUN cd $GOPATH/src/github.com/hashicorp/terraform && echo $GOPATH && go install ./tools/terraform-bundle