Skip to content

Instantly share code, notes, and snippets.

View pbek's full-sized avatar
🐧
🍉 🥭 🍌 🍓 🍒 🍎

Patrizio Bekerle pbek

🐧
🍉 🥭 🍌 🍓 🍒 🍎
View GitHub Profile
@gcatlin
gcatlin / gist:1847248
Created February 16, 2012 19:43
Install specific version of Homebrew formula
brew update
brew versions FORMULA
cd `brew --prefix`
git checkout HASH Library/Formula/FORMULA.rb # use output of "brew versions"
brew install FORMULA
brew switch FORMULA VERSION
git checkout -- Library/Formula/FORMULA.rb # reset formula
## Example: Using Subversion 1.6.17
#

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 30, 2024 12:02
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@thomseddon
thomseddon / gist:3511330
Last active March 8, 2023 03:39
AngularJS byte format filter
app.filter('bytes', function() {
return function(bytes, precision) {
if (isNaN(parseFloat(bytes)) || !isFinite(bytes)) return '-';
if (typeof precision === 'undefined') precision = 1;
var units = ['bytes', 'kB', 'MB', 'GB', 'TB', 'PB'],
number = Math.floor(Math.log(bytes) / Math.log(1024));
return (bytes / Math.pow(1024, Math.floor(number))).toFixed(precision) + ' ' + units[number];
}
});
@martinbean
martinbean / google-feed.php
Created December 20, 2012 12:14
Building a Google RSS feed with DOMDocument.
<?php
$xml = new DOMDocument('1.0', 'UTF-8');
$xml->formatOutput = true;
$rss = $xml->createElement('rss');
$rss->setAttribute('version', '2.0');
$rss->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:g', 'http://base.google.com/ns/1.0');
$xml->appendChild($rss);
@johanneswuerbach
johanneswuerbach / .travis.yml
Last active May 14, 2024 03:50
Deploy an iOS app to testflight using Travis CI
---
language: objective-c
before_script:
- ./scripts/travis/add-key.sh
after_script:
- ./scripts/travis/remove-key.sh
after_success:
- ./scripts/travis/testflight.sh
env:
global:
@egulhan
egulhan / solution.php
Created March 4, 2014 13:42
Solution of PHP SOAP error: looks like we got no XML document
// Source: http://www.highonphp.com/fixing-soap-exception-no-xml
class SoapClientNG extends \SoapClient{
public function __doRequest($req, $location, $action, $version = SOAP_1_1){
$xml = explode("\r\n", parent::__doRequest($req, $location, $action, $version));
$response = preg_replace( '/^(\x00\x00\xFE\xFF|\xFF\xFE\x00\x00|\xFE\xFF|\xFF\xFE|\xEF\xBB\xBF)/', "", $xml[0] );
@codecaffeine
codecaffeine / randimg.rb
Last active February 21, 2024 22:22
Random Image Generator (imagemagick + ruby)
#!/usr/bin/env ruby
# Script to generate random images. Based on http://www.imagemagick.org/Usage/canvas/#random_blur
require 'optparse'
options = {}
optparse = OptionParser.new do |opts|
@arfon
arfon / big_query_examples.md
Last active September 19, 2022 13:00
BigQuery Examples for blog post

How many times shouldn't it happen...

-- https://news.ycombinator.com/item?id=11396045

SELECT count(*)
FROM (SELECT id, repo_name, path
        FROM [bigquery-public-data:github_repos.sample_files]
 ) AS F
@wolkenschieber
wolkenschieber / qownnotes-converttomediawiki.qml
Created August 22, 2016 06:18
QML-script to convert markdown from QOwnNotes to MediaWiki
import QtQml 2.0
import com.qownnotes.noteapi 1.0
QtObject {
function init() {
script.registerCustomAction("convertToMediaWiki", "Convert note to MediaWiki", "Convert to MediaWiki" );
}
function customActionInvoked(identifier) {