Skip to content

Instantly share code, notes, and snippets.

View fwg's full-sized avatar
🐒
I'm a potato.

Friedemann Altrock fwg

🐒
I'm a potato.
View GitHub Profile
1 192.168.5.1 (192.168.5.1) 1.707 ms 10.312 ms 11.180 ms
2 192.168.1.1 (192.168.1.1) 1.267 ms 7.016 ms 1.265 ms
3 lo1.br12.ber.de.hansenet.net (213.191.64.23) 15.981 ms
ge-0-0-0-101.pr04.ber.de.hansenet.net (62.109.108.49) 15.406 ms 14.240 ms
4 as6939.bcix.de (193.178.185.34) 16.254 ms 15.491 ms 14.544 ms
5 10gigabitethernet5-1.core1.ams1.he.net (184.105.213.229) 35.691 ms 45.076 ms 35.518 ms
6 10gigabitethernet2-1.core1.par2.he.net (184.105.213.102) 47.193 ms 41.061 ms 48.241 ms
7 10gigabitethernet7-1.core1.ash1.he.net (184.105.213.93) 128.470 ms 123.040 ms 121.042 ms
8 10gigabitethernet1-2.core1.atl1.he.net (184.105.213.110) 135.852 ms 131.892 ms 141.362 ms
9 216.66.0.26 (216.66.0.26) 132.440 ms 139.692 ms 134.707 ms
@fwg
fwg / README.md
Last active December 12, 2015 03:29
But in machina.js 0.3.1

Inheritance bug in machina 0.3.1

The bug occurs when you inherit from the same base FSM multiple times and overwrite the same states/actions.

npm install and node bug.js to verify.

@fwg
fwg / build.log
Created January 16, 2013 16:17
trying to build node
make -C out BUILDTYPE=Release V=1
c++ '-D_DARWIN_USE_64_BIT_INODE=1' '-DENABLE_DEBUGGER_SUPPORT' '-DV8_TARGET_ARCH_X64' -I../deps/v8/src -O3 -gdwarf-2 -mmacosx-version-min=10.5 -arch x86_64 -Wall -Wendif-labels -W -Wno-unused-parameter -fno-rtti -fno-exceptions -fno-threadsafe-statics -fno-strict-aliasing -MMD -MF /Users/fwg/dev/node/out/Release/.deps//Users/fwg/dev/node/out/Release/obj.target/v8_base/deps/v8/src/accessors.o.d.raw -c -o /Users/fwg/dev/node/out/Release/obj.target/v8_base/deps/v8/src/accessors.o ../deps/v8/src/accessors.cc
cc1plus: error: unrecognized command line option "-arch"
make[1]: *** [/Users/fwg/dev/node/out/Release/obj.target/v8_base/deps/v8/src/accessors.o] Error 1
make: *** [node] Error 2
@fwg
fwg / bomb.c
Created November 19, 2012 21:17
high cpu load with a few threads
# compile with gcc -O0 bomb.c -o bomb
#
#include <stdio.h>
#include <pthread.h>
#include <stdlib.h>
void *thread(void *arg);
int main() {
pthread_t t1, t2, t3, t4;
@fwg
fwg / gist:3859529
Created October 9, 2012 15:28
Make HTML entities
var unsafeHTML = "<script>alert(1)</script>";
var p = document.createElement('p');
if ('innerText' in p) {
p.innerText = unsafeHTML;
} else {
p.textContent = unsafeHTML;
}
var safeHTML = p.innerHTML;
@fwg
fwg / testIsArrayOf.js
Created February 1, 2012 17:55 — forked from line-o/testIsArrayOf.js
isArrayOf(array2test, type2match)
var typeUtils =
literals = ['boolean', 'string', 'number', 'object'],
types2test = literals.concat([new RegExp(/asd/), new Number(1), new String('#')]),
testArrays = [
[true, false, true],
[1, 2, 3],
['a', 'b', 'c'],
[/sdf/, /asdf/, /asf/],
[{}, {}, {}],
[new String('a'), new String('b'), new String('c')],
@fwg
fwg / .gitignore
Created January 27, 2012 13:25 — forked from line-o/PS.js
node js module to find a representation for a string with chemical elements
.idea/
*~
*.swp
/*
* Stringverarbeitung.c
*/
#include <stdio.h> // for printf, fgets, stdin
int main() {
printf("String insert:");
char string[100];
fgets(&(string[0]), 100, stdin);
@fwg
fwg / gist:1165259
Created August 23, 2011 14:24
Insert product status attribute for products that don't have it
INSERT INTO catalog_product_entity_int
(entity_type_id,attribute_id,store_id,entity_id,value)
SELECT
4 AS entity_type_id,
80 AS attribute_id,
0 AS store_id,
product.entity_id,
1 AS value
FROM
catalog_product_entity product
@fwg
fwg / gist:1165150
Created August 23, 2011 13:43
select magento products that have no status
SELECT
product.entity_id
FROM
catalog_product_entity product
LEFT JOIN catalog_product_entity_int status
ON (status.entity_id=product.entity_id and status.attribute_id=80)
WHERE
status.value IS NULL