Skip to content

Instantly share code, notes, and snippets.

Avatar

Stephan Bösch-Plepelits plepe

View GitHub Profile
@plepe
plepe / __FILE__.js
Created Oct 15, 2012
__FILE__ in JavaScript
View __FILE__.js
/***
* This gist provides a __FILE__ variable, which holds the path to the file
* from which the currently running source is being executed.
*
* Usage example: alert(__FILE__);
*
* Thanks to http://ejohn.org/blog/__file__-in-javascript/ on which this gist
* is based on.
*
* Tested in Mozilla Firefox 9, Mozilla Firefox 16, Opera 12, Chromium 18
@plepe
plepe / get_proc_children.php
Created Aug 31, 2012
A function, returning an array of process ids of children (and their children, ...) of a process
View get_proc_children.php
<?php
function get_proc_children($pid, $tree=null) {
$tree=array();
$ret=array();
// build process tree in $tree
if($tree==null) {
$p=popen("ps eo pid,ppid", "r");
while($r=fgets($p)) {
if(preg_match("/^\s*([0-9]+)\s+([0-9]+)/", $r, $m)) {
@plepe
plepe / README.creole
Created Dec 15, 2010
This GIST has been moved to a repository: https://github.com/plepe/wgetar
View README.creole

Often you need to download and extract archives from the internet, e.g. to install Drupal modules. Therefore you download the archive, extract it and remove the original archive. Using modern[tm] UNIX pipes you can directly pipe it to tar; therefore you don't need to save and remove the archive.

Example:

user@host> wgetar http://ftp.drupal.org/files/projects/views-7.x-3.5.tar.gz

See the result: {{{ user@host> ls -R

View Automatisch Diagramme in Excel anlegen
Function DiagrammAnlegen(ws, i)
Dim curgem As Integer
' Konfiguration auslesen
anz_gem = WorkSheets(ws).Range("G9").Value
first_kz = WorkSheets(ws).Range("G10").Value
last_kz = WorkSheets(ws).Range("G11").Value
delta_gem = WorkSheets(ws).Range("G12").Value
' Chart anlegen und selektieren
You can’t perform that action at this time.