Skip to content

Instantly share code, notes, and snippets.

@powtac
powtac / problems.amf
Created May 24, 2020 19:53
problems.amf
This file has been truncated, but you can view the full file.
<?xml version="1.0" encoding="UTF-8"?>
<amf unit="millimeter">
<metadata type="cad">Slic3r 2.2.0+win64</metadata>
<metadata type="slic3rpe_amf_version">2</metadata>
<metadata type="slic3rpe_config">
; avoid_crossing_perimeters = 0
; bed_custom_model =
; bed_custom_texture =
; bed_shape = 0x0,180x0,180x180,0x180
; bed_temperature = 60
@powtac
powtac / problems.gcode
Created May 24, 2020 19:10
problems.gcode
This file has been truncated, but you can view the full file.
; generated by PrusaSlicer 2.2.0+win64 on 2020-05-24 at 17:25:15 UTC
;
; thumbnail begin 16x16 996
; iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACsElEQVR4AW2TXU/TUBzGm3BDuPKSGy
; 5UdIMxnHvpyt7XrWVd13Zdu7dubAMVMo2KxKCixN0sxKABjKKJSkh8SdREErwwMVz5RfgIfoTHnmOK
; SGjypCcn+f/O83/O/zCxWAynKZPJQBRFxONxsCyLkZGRvYGBgTPMye9kISkQBAHpdBrZ5L99AnG5XI
; dDQ0Op/wDJZBKmEEMikUA1l4QkSSB7Kh/B13YQV6bD0Ow1gUQiEfh8PgwPD28cuZmXwtjr+LFRCeHX
; dQ5bVhR8Mk4ha6oX3+cCOFgIoyv/hWQTUYRCIbjd7sPBwUEf81gLYr3gxlrehf3ZAIXsX5tCXUphTm
@powtac
powtac / Ssh.php
Created April 14, 2016 11:29
Simple SSH connection wrapper for PHP
class Ssh {
protected $_connection = NULL;
public $error = FALSE;
public function __construct($host, $user, $pub_key, $priv_key) {
$this->_connection = ssh2_connect($host);
if (!ssh2_auth_pubkey_file($this->_connection, $user, $pub_key, $priv_key)) {
$this->error = 'Can not connect to "'.$host.'".';
<?php
/**
* Handles bulk inserts to a MySQL database. This wil only work on base DataObject tables
* as there is currently no way to relate to child tables in a bulk insert.
*
* @package ultimateprediction
* @subpackage core
*
* @author Michael Strong <micmania@hotmail.co.uk>
Taken from http://stevelorek.com/how-to-shrink-a-git-repository.html
Reclaim space
While we may have rewritten the history of the repository, those files still exist in there, stealing disk space and generally making a nuisance of themselves. Let's nuke the bastards:
rm -rf .git/refs/original/
git reflog expire --expire=now --all
git gc --prune=now
git gc --aggressive --prune=now
@powtac
powtac / gist:6717688
Created September 26, 2013 17:35
URL Hash rewriting example.com/app/login gets rewritten into example.com/app/#!login which is auto resolved via history API in the client trough Angular JS.
<Directory /var/www/plain/app/>
# See https://httpd.apache.org/docs/2.2/rewrite/flags.html#page-header
# See http://stackoverflow.com/a/15135130/22470
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/app/([^/]+)/? [NC]
RewriteRule .* /app/#!%1 [R=301,NE,L]
</Directory>
@powtac
powtac / gist:5172911
Last active December 15, 2015 00:28
Clean up a stupid website
var s=document.createElement('script');
s.setAttribute('src','//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js');
document.getElementsByTagName('body')[0].appendChild(s);
function _removeall() {
jQuery('iframe[src*="chat"]').remove().remove();
jQuery('iframe[src*="twitter.com"]').remove().remove();
jQuery('script:not([src*="jquery"])').remove().remove();
@powtac
powtac / jquery_change_textfield_immediately.js
Created January 9, 2013 16:43
Trigger jQuery change immediately on input fields when typing something.
$(document).ready(function() {
$('input').bind('mouseenter mouseleave keyup keydown', function() { // use .on() instead of .bind() on jQuery < version 1.7
$(this).trigger('change');
});
})