Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@w00fz
w00fz / sphp.sh
Last active February 7, 2022 00:12
PHP switcher
#!/bin/bash
# Check if command was ran as root.
if [[ $(id -u) -eq 0 ]]; then
echo "The command \"sphp\" should not be executed as root or via sudo directly."
echo "When a service requires root access, you will be prompted for a password as needed."
exit 1
fi
# Usage
@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@adactio
adactio / basicServiceWorker.js
Last active March 27, 2023 09:30
A basic Service Worker, for use on, say, a blog.
'use strict';
// Licensed under a CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
// http://creativecommons.org/publicdomain/zero/1.0/
(function() {
// Update 'version' if you need to refresh the cache
var staticCacheName = 'static';
var version = 'v1::';
@chucknado
chucknado / main.js
Last active January 20, 2017 21:32
A Zendesk app for a tutorial on adding OAuth at https://support.zendesk.com/hc/en-us/articles/205225558
$(function() {
var client = ZAFClient.init();
client.invoke('resize', {width: '100%', height: '400px'});
showStart();
$("#check-token").click(function (event) {
event.preventDefault();
client.invoke('notify', 'Authenticating...');
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@lsd
lsd / IdeaVim OS X Key Repeat.markdown
Last active December 12, 2023 18:09
Enable key-repeat for ALL applications or just for IdeaVim/specific JetBrains apps

Upgrading to Lion or Yosemite and WebStorm 9, I noticed key repeat was
turned off for the IdeaVim plugin h j k l keys.

System-wide key repeat

defaults write -g ApplePressAndHoldEnabled -bool false in a terminal will enable
key repeat for every app. This can alternatively be found in the accessibility settings in OS X' preferences.

App specific key repeat

<?php
/**
* Lists bundles that have a field of type image or file for D7.29 regression
* https://www.drupal.org/node/2305017
*
* Download this script on your server/localhost and run
* drush php-script 2305017_file_lost.php
*/
@rshk
rshk / kibana-apache-logs.json
Created May 6, 2014 16:16
Kibana: analyze Apache logs
{
"title": "Apache logs",
"services": {
"query": {
"list": {
"0": {
"query": "*",
"alias": "",
"color": "#7EB26D",
"id": 0,
@jordansissel
jordansissel / apachedashboard.json
Created March 21, 2014 23:09
Kibana 3.0.0 dashboard for Apache access logs w/ default 'combined' apache log format. Parsed with logstash 1.4.0 using grok, date, geoip, and useragent filters.
{
"title": "Apache Overview",
"services": {
"query": {
"list": {
"2": {
"id": 2,
"type": "topN",
"query": "",
"alias": "",
@trdarr
trdarr / hubot-digitalocean.md
Last active March 28, 2022 20:34
Deploying Hubot on DigitalOcean (with Slack integration)