Skip to content

Instantly share code, notes, and snippets.

View AndiH's full-sized avatar
🤖
q|^_^|p

Andreas Herten AndiH

🤖
q|^_^|p
View GitHub Profile
@AndiH
AndiH / gist:3878427
Created October 12, 2012 09:44
OS X defaults
### Useful defaults
### Extracted from the .osx file of Mathias Bynens
### https://github.com/mathiasbynens/dotfiles/blob/master/.osx
### Finder stuff
# Expand save panel by default
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
# Save to disk (not to iCloud) by default
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false
# Automatically quit printer app once the print jobs complete
@AndiH
AndiH / ROOT-Shell.sublime-build
Created November 7, 2012 16:04
C++/ROOT: Build System (runs »root -l« for current file)
{
"path": "/Applications/Panda/extpkg/bin", // point this to the directory of your root / root.exe
"selector": "source.cpp, source.c, source.c++",
"working_dir": "${file_path}",
"cmd": ["root", "-l", "$file"],
"variants": [
{
"cmd": ["root", "-l", "$file+"], // delivers a command palette only option to run root with compiling the macro before executing it (the + option) - but doesn't run, since clang++ can't be found. If you want to fix it: fix it.
"name": "ROOT: Compile (+)"
@AndiH
AndiH / houghtest.cpp
Created November 14, 2012 13:34
ROOT: Test code for sample Hough Transformation not around a point but a circle with given radius r
#include <iostream>
#include <vector>
#include <cfloat>
void readPoints(string filename, std::vector<double> &x, std::vector<double> &y, std::vector<double> &r, int upToLineNumber = 2) {
ifstream file(filename.c_str());
float tempX, tempY, tempZ, tempR, tempI;
char tempChar[10];
int i = 1;
while(i <= upToLineNumber && file >> tempX >> tempY >> tempZ >> tempR >> tempI >> tempChar) {
@AndiH
AndiH / printDeviceInfo.cu
Created November 22, 2012 13:43
Small example code for some special device queries - for a whole device information use deviceQuery from the CUDA SDK Samples dir
#include <stdio.h>
/**
* Source: https://developer.nvidia.com/content/how-query-device-properties-and-handle-errors-cuda-cc
* Documentation of cudaDeviceProp: http://docs.nvidia.com/cuda/cuda-runtime-api/index.html#structcudaDeviceProp
*
* Sample line to compile:
* nvcc -arch=sm_20 -o printDeviceInfo printDeviceInfo.cu
*/
@AndiH
AndiH / confmaptest.cpp
Created November 27, 2012 16:15
ROOT: Visualization of conformal mapping of points with isochrone radii - including a comparison between a simplified approach and a correct one
#include <iostream>
#include <algorithm>
#include <vector>
#include <cfloat>
void readPoints(string filename, std::vector<double> &x, std::vector<double> &y, std::vector<double> &r, int upToLineNumber = 2) {
ifstream file(filename.c_str());
float tempX, tempY, tempZ, tempR, tempI;
char tempChar[10];
int i = 1;
@AndiH
AndiH / Andinstagram Stylesheet [CSS]
Created January 3, 2013 10:32
Stylesheet for Andinstagram (http://gram.andreasherten.de/), my WordPress-based Instagram mirror. This stylesheet builds up on the Response (2.0) WordPress theme.
/*
gram.andreasherten.de custom CSS file to mimic the looks of Instagram.
Done by Andreas Herten // @AndiH // www.andreasherten.de.
Feel free to copy. Maybe leave a backlink to me in it. Thx.
*/
body {
background: rgb(231,231,231) url('http://gram.andreasherten.de/wp-content/uploads/2012/12/noise.png');
}
h1 a {
@AndiH
AndiH / common.cpp
Created April 4, 2013 13:51
common root configurations
namespace andi {
namespace global {
void common() {
std::cout << "Setting defaults." << std::endl;
set_plot_style();
}
@AndiH
AndiH / howto.md
Last active December 16, 2015 13:29
»Clone« in German Inkscape

My Inkscape modifications

Two Problems

  • Inkscape runs in X11/XQuartz (=Alt/Cmd are messy)
  • German localization overlays Alt+D binding for »Clone«.

1 – Alt/Cmd fix

Activate second-to-last option in the Input tab of XQuartz preferences. In German it's »Wahltasten entsprechen Alt_L und Alt_R« (so probably: Option Keys map to Alt_L and Alt_R). Alternatively you can put the following four lines into your ~/.Xmodmap

@AndiH
AndiH / main.cpp
Created July 2, 2013 12:57
HOW TO example: Function pointers, external / internal [C++]
/*
Demonstration of how to use function pointers in classes.
First off, a class called operationClass is defined. This can as well be extracted to a single operationClass.h file. It's included in this cpp file to give a short overview.
operationClass is calle by the subsequent main().
opreationClass provides a method to set its internal calculation function to squaring and one to cubing. It also provides a method to call giving an external calculation function. The three examples are given in main().
Andreas Herten, 2.7.2013
@AndiH
AndiH / gist:6219263
Created August 13, 2013 09:03
Zusammenfassung des Hyperloop-Whitepapers. In 7*140 Zeichen oder weniger.
2 Röhren (1 pro Richtung) zwischen LA & San Francisco (600km). Eine Kapsel alle 37 km / 2 Min (Stoßzeit: 30 Sek), 28 Personen.
Weg: 35 Min, 1200 km/h max. Ticket: $20. Gesamtkosten Projekt: $6 Milliarden. 10% des aktuellen Vorschlags (ICE-esker Zug).
Röhre auf 100 Pa evakuiert (Normaldruck = 10⁵ Pa). Antrieb über halb externe, lineare Elektromotoren an Röhrenbeginn.
Kapsel: Zieht aufstauende Luft durch Turbine vorne an, nutzt sie zum Teil zum Antrieb, hauptsächlich aber für Luftkissen.
Röhre: ⌀ 2,50 m. Auf 25.000 Säulen. Ein Säule alle 30m. Säulenhöhe zw. 6m und 30m, je nach Gelände.
Doppelröhrensystem ist komplett mit PV-Zellen bestückt. Produziert im Jahresdurchschnitt 57 MW, ⅓ braucht Hyperloop davon selbst.
Es gibt Alternativvorschläge für größere Röhren: Passagiere+Autos und Passagiere+Autos+Lastentransport. Hyperloop ist ›Open Source‹.