Skip to content

Instantly share code, notes, and snippets.

View AndreasBaumgart's full-sized avatar

Andreas Baumgart AndreasBaumgart

View GitHub Profile
require 'open-uri'
namespace :rm2022_nodes_export do
desc 'Export for Roadmap 2020'
task export: :environment do
node_paths = %w[
community
die-community/albert-lehmann
die-community/community-30676
die-community/community-34487
import 'rxjs/add/observable/interval';
import {Injectable} from '@angular/core';
import {Headers, Http, Response as HttpResponse} from '@angular/http';
import {Observable} from 'rxjs/Observable';
import {Observer} from 'rxjs/Observer';
import {Store} from '@ngrx/store';
import {getIdentity, State} from '../../store/reducers';
import {Identity} from '../auth/identity';
import {I18nService} from '../i18n/service';
#!/bin/bash
for i in {0..28};
do
firstPageNumber=$(expr \( $i \* 16 \) + 1)
lastPageNumber=$(expr $firstPageNumber + 15)
dest="$(printf "%04d\n" $firstPageNumber)-$(printf "%04d\n" $lastPageNumber).pdf"
gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER \
-dFirstPage=$firstPageNumber \
@AndreasBaumgart
AndreasBaumgart / find_largest_tables.sql
Created November 21, 2012 11:34
SQL query that returns a summary of the largest tables on the server.
SELECT
CONCAT(table_schema, '.', table_name),
CONCAT(ROUND(table_rows / 1000000, 2), 'M') rows,
CONCAT(ROUND(data_length / (1024 * 1024 * 1024), 2),
'G') DATA,
CONCAT(ROUND(index_length / (1024 * 1024 * 1024), 2),
'G') idx,
CONCAT(ROUND((data_length + index_length) / (1024 * 1024 * 1024),
2),
'G') total_size,
@AndreasBaumgart
AndreasBaumgart / mysql-anything-to-utf8.php
Created June 4, 2010 14:32
Alter the encoding type of all text-like columns in a MySQL database from anything to UTF8 but without touching the bytes itself. Don't ask.
<?php
$sql = '';
$pdo = Propel::getConnection();
$stmt = $pdo->query('SHOW FULL TABLES');
$tables = $stmt->fetchAll(PDO::FETCH_NUM);
foreach($tables as $tbl) {
$tblName = $tbl[0];
<pre><?php
class A {
private $a = 'trallala';
protected $b = array(1,2,3);
public $foo = 'bar';
}
class B extends A {
<?php
if(isset($_POST['source'])) {
$source = $_POST['source'];
if(isset($_POST['type']) && 'php' == $_POST['type']) {
$code = highlight_string($source, true);
$output = $code;
} else {
$code = htmlentities($source);
./configure \
--prefix=/Users/andreas/Applications/PHP5 \
--with-pear \
--with-bz2=shared,/sw \
--with-mcrypt=shared,/sw \
--with-iconv-dir=/sw \
--with-zlib-dir=/usr/local \
--with-jpeg-dir=/sw \
--with-png-dir=/sw \
--with-gd=shared \