Skip to content

Instantly share code, notes, and snippets.

@rikukissa
rikukissa / .gitignore
Last active Dec 17, 2015
Darker theme for Shout. Has a bit more eye-friendly color scheme and hides some IMO unnecessary features such as "Leave" and "Submit" buttons.
@patricksurry
patricksurry / README.md
Last active Feb 6, 2018
Imitate hand-drawn (imperfect) circles using cubic Bézier segments
View README.md

Imitate hand-drawn (imperfect) circles using cubic Bézier segments, based on a Bézier approximation to a perfect circle. TLDR: a good approximation to a quarter circle of unit radius is a cubic Bézier curve with control points P0 = (0,1), P1 = (c,1), P2 = (1,c), P3 = (1,0) where c = 0.551915024494. By varying the points in a sensible way, we can do a good impression of hand-drawn circles.

@hasantayyar
hasantayyar / git-dropbox-fix.sh
Created Jan 9, 2014
Solution if you are using dropbox and git same time and if you get this error "fatal: Reference has invalid format: refs/heads/master conflicted copy"
View git-dropbox-fix.sh
find . -type f -name "* conflicted copy*" -exec rm -f {} \;
awk '!/conflicted/' .git/packed-refs > temp && mv temp .git/packed-refs
@hubgit
hubgit / README.md
Last active Jan 19, 2021
Remove metadata from a PDF file, using exiftool and qpdf. Note that embedded objects may still contain metadata.
View README.md

Anonymising PDFs

PDF metadata

Metadata in PDF files can be stored in at least two places:

  • the Info Dictionary, a limited set of key/value pairs
  • XMP packets, which contain RDF statements expressed as XML

PDF files

View urbanspoon_reservations.rb
require 'rubygems'
require 'mechanize'
FIRST_NAME = 'FIRST_NAME'
LAST_NAME = 'LAST_NAME'
PHONE = 'PHONE'
EMAIL = 'EMAIL@provider.com'
PARTY_SIZE = 2
SCHEDULE_RANGE = { :start_time => '19:00', :end_time => '20:30' }
@leetrout
leetrout / monokai.ksf
Created Apr 24, 2012
My Monokai Theme for Komodo Edit
View monokai.ksf
Version = 4
Booleans = {'caretLineVisible': True, 'preferFixed': True, 'useSelFore': True}
CommonStyles = {'attribute name': {'fore': 7872391},
'attribute value': {'fore': 3100463},
'bracebad': {'back': 65535, 'bold': 1, 'fore': 16777215},
'bracehighlight': {'bold': 1, 'fore': 16777215},
'classes': {'bold': True, 'fore': 3272098},
'comments': {'fore': 7301991, 'italic': 1},
@cballou
cballou / get-ip-address-optimized.php
Created Mar 26, 2012
PHP - Advanced Method to Retrieve Client IP Address
View get-ip-address-optimized.php
<?php
function get_ip_address() {
$ip_keys = array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR');
foreach ($ip_keys as $key) {
if (array_key_exists($key, $_SERVER) === true) {
foreach (explode(',', $_SERVER[$key]) as $ip) {
// trim for safety measures
$ip = trim($ip);
// attempt to validate IP
if (validate_ip($ip)) {
@gourneau
gourneau / imagemagick_php_thumbnail.php
Created Nov 29, 2010
Create a thumbnail or resize an image with Imagemagick in PHP
View imagemagick_php_thumbnail.php
<?php
//Dynamically resize images
function thumb_create($file, $width , $height ) {
try
{
/*** the image file ***/
$image = $file;
/*** a new imagick object ***/