Skip to content

Instantly share code, notes, and snippets.

View jamosaur's full-sized avatar
🖤

James Wallen-Jones jamosaur

🖤
View GitHub Profile
<?php
//original article is here http://css-tricks.com/snippets/php/sanitize-database-inputs/
function cleanInput($input) {
$search = array(
'@<script[^>]*?>.*?</script>@si', // Strip out javascript
'@<[\/\!]*?[^<>]*?>@si', // Strip out HTML tags
FROM ubuntu:14.04
MAINTAINER "Chris White" <chris@cwhite.me>
# Use bash instead of sh
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
# Install required packages
RUN apt-get update
RUN apt-get install -y curl git nginx php5-cli php5-fpm php5-mysql php5-mcrypt php5-curl php5-gd supervisor
RUN php5enmod mcrypt
@dansherman
dansherman / blinker.py
Created January 8, 2013 22:07
Python script for blink(1) It checks weather and connectivity, then blinks a pattern depending on the result. It should be easy to add more info to the pattern too, depending on what you want to display.
#! /usr/bin/python
import sys
from time import sleep
import subprocess
from subprocess import call
import logging
import threading
import urllib
import json
from colorsys import hsv_to_rgb
git log --pretty='format:%B' master..
| egrep -o "PROJ-[[:digit:]]{1,}"
| sort
| uniq
| xargs -I % sh -c 'curl -u $JIRA_AUTH -H "Content-Type: application/json" https://yourjira.atlassian.net/rest/api/2/issue/%'
| jq -r '[.key, .fields.issuetype.name, .fields.assignee.displayName, .fields.status.name, .fields.summary] | "\(.[0]): (\(.[1]), \(.[3])) \(.[4]) | \(.[2])"'
# output:
#
# PROJ-1234: (Story, Done) The summary of the ticket | Assignee Name
@highflyersnl
highflyersnl / fancontrol python 3.4 code
Created August 28, 2017 12:04
this is to control a fan on a raspberry pi with python 3.4 on a bc332 transistor
#!/usr/bin/env python3
# first author: Edoardo Paolo Scalafiotti <edoardo849@gmail.com>
# Edits done by: Marco Bosch <marcogithub@hotmail.com>
import os
from time import sleep
import signal
import sys
import RPi.GPIO as GPIO
@steventroughtonsmith
steventroughtonsmith / gist:6788b6c340a0aa52345a
Created October 27, 2015 05:19
Run OS X Screen Saver as Wallpaper
/System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -background
@fahied
fahied / apns
Created March 20, 2016 07:52
How to create APNS Certificates and merge into one PEM
Step 1: Create Certificate .pem from Certificate .p12
Command: openssl pkcs12 -clcerts -nokeys -out apns-dev-cert.pem -in apns-dev-cert.p12
Step 2: Create Key .pem from Key .p12
Command : openssl pkcs12 -nocerts -out apns-dev-key.pem -in apns-dev-key.p12
Step 3: Optional (If you want to remove pass phrase asked in second step)
Command : openssl rsa -in apns-dev-key.pem -out apns-dev-key-noenc.pem
Step 4: Now we have to merge the Key .pem and Certificate .pem to get Development .pem needed for Push Notifications in Development Phase of App
@neoneye
neoneye / guide.md
Last active November 20, 2022 14:26
Install GraphicsMagick on AWS EC2 running Ubuntu Linux
# based on https://github.com/amber-sixel/PythonCatPrinter.git
# can be used as a raw postscript printer (a4, one page only) on port 9100
#
# status : curl --location --request GET 'localhost:5000'
#
# curl --location --request POST 'localhost:5000' \
# --form 'image=@"/image.jpg"' \ #optional
# --form 'text="hello world"' \ #optional
# --form 'size="48"' \ #optional
@messi89
messi89 / \Laravel\Passport\Http\Controllers\AccessTokenController
Last active August 25, 2023 12:33
Laravel Passport - Customize The Token Response
<?php
/**
* Laravel Passport - Customize Token response.
*
* @author Messi89 OVERGEN <@messi89minou>
* @link https://github.com/messi89
*/
namespace App\Http\Controllers\Api;
use App\Models\User;