Skip to content

Instantly share code, notes, and snippets.

@migerh
migerh / xrandr scale example
Created January 19, 2011 22:30
get a higher resolution on low res screens via xrandr with scaling and output the high res one on an external monitor
#!/bin/bash
# ~/Scripts/1024scale.sh
# change display settings to clone mode, 1024x768 pix for VGA (projector) and scales it to the resolution of 1024x600 of the internal display
xrandr --newmode "1024x768" 63.50 1024 1072 1176 1328 768 771 775 798 -hsync +vsync
xrandr --addmode VGA1 1024x768
xrandr --fb 1024x768
xrandr --fb 1024x768 --output LVDS1 --mode 1024x600 --scale 1x1.28 --panning 0x0
xrandr --output VGA1 --same-as LVDS1 --mode 1024x768
@migerh
migerh / xrandr scale example
Created January 19, 2011 22:32
get high res on low res screens
#!/bin/bash
xrandr --fb 1536x900 --output LVDS1 --mode 1024x600 --scale 1.5x1.5 --panning 0x0
@migerh
migerh / vdimount.py
Created February 5, 2011 19:40
Mount a VirtualBox .vdi HDD Image File
#!/usr/bin/env python
import sys
import os
import subprocess
def usage():
print "Usage:\n\n " + sys.argv[0] + " <vdi-File> <mount point>"
if len(sys.argv) < 3:
@migerh
migerh / fp-2011-02-04.js
Created February 6, 2011 11:02
Solve the equation "1 2 3 4 5 6 7 8 9 = 100" by putting in only adds and takes. Requires a div with id "result" on the page to work.
var calc = function() {
var coefficients = [1, 2, 3, 4, 5, 6, 7, 8, 9],
signTable = ['-', '', '+'],
cases = 0,
caseFormula = '',
ternary = '',
i = 0,
result = {},
r = document.getElementById('result'),
@migerh
migerh / gist:1275802
Created October 10, 2011 17:04
cuda matrix addition example
// Kernel definition
__global__ void MatAdd(float A[N][N], float B[N][N], float C[N][N]) {
int i = threadIdx.x;
int j = threadIdx.y;
C[i][j] = A[i][j] + B[i][j];
}
int main() {
// Kernel invocation with one block of N * N * 1 threads
int numBlocks = 1;
@migerh
migerh / gist:1275805
Created October 10, 2011 17:08
cuda c example matrix addition with #blocks >= 1
// Kernel definition
__global__ void MatAdd(float A[N][N], float B[N][N], float C[N][N]) {
int i = blockIdx.x * blockDim.x + threadIdx.x;
int j = blockIdx.y * blockDim.y + threadIdx.y;
if (i < N && j < N)
C[i][j] = A[i][j] + B[i][j];
}
int main() {
// Kernel invocation
@migerh
migerh / gist:1278233
Created October 11, 2011 14:32
diff of r256
Index: Documents/katowice/index.html
===================================================================
--- Documents/katowice/index.html (revision 255)
+++ Documents/katowice/index.html (revision 256)
@@ -424,7 +424,7 @@
<h3 style="margin-top: -20px">
JSXGraph - visualizing mathematics on (nearly) every device
</h3>
- <p style="font-size: 28px; margin-top: -20px">Michael Gerh&auml;user, Alfred Wassermann,<br /> University of Bayreuth, Germany</p>
+ <p style="font-size: 28px; margin-top: -20px">Michael Gerh&auml;user, Alfred Wassermann<br /> University of Bayreuth, Germany</p>
@migerh
migerh / gist:1278593
Created October 11, 2011 16:26
diff to downscale 1024x768 presentation to 800x600
@@ -78,11 +78,11 @@
display: block; /* none */
position: absolute;
overflow: hidden;
- width: 900px;
- height: 700px;
+ width: 700px;
+ height: 550px;
left: 50%;
top: 50%;
@migerh
migerh / jessiecode.par.js
Created January 30, 2012 14:54
just trying the webstorm gist integration
/**
* Assigns a value to a variable in the current scope.
* @param {String} vname Variable name
* @param {%} value Anything
* @see JXG.JessieCode#sstack
* @see JXG.JessieCode#scope
*/
letvar: function (vname, value) {
if (this.builtIn[vname]) {
this._warn('"' + vname + '" is a predefined value.');
@migerh
migerh / share.dasm16
Created April 15, 2012 05:55
dcpu asm reference example
set A, 0x30 ; 7c01 0030
SET [0x1000], 0x20 ; 7de1 1000 0020
SUB a, [0x1000] ; 7803 1000
IfN A, 0x10 ; c00d
SET Pc, crash ; 7dc1 001a [*]
; Do a loopy thing
SET I, 10 ; a861
SET A, 0x2000 ; 7c01 2000