Skip to content

Instantly share code, notes, and snippets.

@felixrabe
felixrabe / Dockerfile
Last active August 29, 2015 14:07
Simple webserver in Bash for Raspberry Pi using Docker
FROM sdhibit/rpi-raspbian
RUN apt-get update && apt-get install -y netcat-openbsd
RUN echo 'HTTP/1.1 200 OK' >> www
RUN echo 'Content-Type: text/html' >> www
RUN echo >> www
RUN echo '<h1>Hello <i>world!</i></h1>' >> www
EXPOSE 9999
CMD ["/bin/bash", "-c", "while true ; do nc -l 9999 < www > /dev/null ; done"]
@remmelt
remmelt / bamboo-to-slack.py
Last active August 31, 2023 00:35
Post an Atlassian Bamboo build result to Slack
#!/usr/bin/python
"""
Create a stage in your project, make it the last stage.
Make a task in the stage with this inline script:
#! /bin/bash
/some/path/bamboo-to-slack.py "${bamboo.planKey}" "${bamboo.buildPlanName}" "${bamboo.buildResultsUrl}"
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active February 12, 2024 17:18
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

OBSOLETE

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

@swarminglogic
swarminglogic / watchfile.sh
Last active March 4, 2024 14:44
watchfile - monitor file(s) and execute a command when files are changed
#!/bin/bash
version=1.0.1
versionDate="2014-02-14"
function showHelp() {
echo "watchfile - monitor file(s)/command and perform action when changed
Possible ways of usage
----------------------------------------
@hschnegg
hschnegg / PostgreSQL test if text can be cast to numeric
Created January 28, 2014 15:08
PostgreSQL: Test if text can be cast to numeric
select (mytext ~ '^([0-9]+[.]?[0-9]*|[.][0-9]+)$');
@bickart
bickart / tincheck.php
Created August 1, 2012 20:44
Example Code to access tincheck.com's webservice
<?php
/**
* August 1, 2012
*
* Jeff Bickart
* Twitter: @bickart
* Blog: http://sugarcrm-dev.blogspot.com/
*
* The following is a example of usage of the tincheck.com web-service to test the ValidateTinName
@jordelver
jordelver / gist:3139365
Created July 18, 2012 22:29
How to write an image file to an SD card under Mac OS X (for Raspberry Pi)

Find the SD card device

In this case, the SD card is /dev/disk4. DO NOT get this wrong or you may destroy all the data on the wrong disk/card/drive.

diskutil list

/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *160.0 GB   disk0

1: EFI 209.7 MB disk0s1

@ziadoz
ziadoz / awesome-php.md
Last active April 17, 2024 21:06
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.
@cjus
cjus / jsonval.sh
Created June 26, 2011 17:42
Extract a JSON value from a BASH script
#!/bin/bash
function jsonval {
temp=`echo $json | sed 's/\\\\\//\//g' | sed 's/[{}]//g' | awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | sed 's/\"\:\"/\|/g' | sed 's/[\,]/ /g' | sed 's/\"//g' | grep -w $prop`
echo ${temp##*|}
}
json=`curl -s -X GET http://twitter.com/users/show/$1.json`
prop='profile_image_url'
picurl=`jsonval`