Skip to content

Instantly share code, notes, and snippets.

View kaero's full-sized avatar
🐢
slow developer

Philipp Kovalev kaero

🐢
slow developer
View GitHub Profile

Keybase proof

I hereby claim:

  • I am kaero on github.
  • I am twilightfeel (https://keybase.io/twilightfeel) on keybase.
  • I have a public key whose fingerprint is 94CF C072 3186 73FC 7A36 FE34 AC23 E3FC 53FD 3288

To claim this, I am signing this object:

$ make openmw-wizard
Scanning dependencies of target components
[ 0%] Building CXX object components/CMakeFiles/components.dir/process/processinvoker.cpp.o
openmw_pvdk/components/process/processinvoker.cpp:65:14: error: use of undeclared identifier 'QCoreApplication'; did you mean 'QApplication'?
QDir dir(QCoreApplication::applicationDirPath());
^~~~~~~~~~~~~~~~
QApplication
/Library/Frameworks/QtGui.framework/Headers/qwindowdefs.h:87:7: note: 'QApplication' declared here
class QApplication;
^
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal

The prep-script.sh will setup the latest Node and install the latest perf version on your Linux box.

When you want to generate the flame graph, run the following (folder locations taken from install script):

sudo sysctl kernel/kptr_restrict=0

perf record -i -g -e cycles:u -- ~/sources/node/node --perf-basic-prof script.js

perf script | egrep -v "( __libc_start| LazyCompile | v8::internal::| Builtin:| Stub:| LoadIC:|\[unknown\]| LoadPolymorphicIC:)" | sed 's/ LazyCompile:[*~]\?/ /' | ~/sources/FlameGraph/stackcollapse-perf.pl > out.perf-folded
" dont backup anything if vim launched with root priveleges
if $USER != 'root'
" create and set backup, swap and undo directories
let s:tmp_path = '/tmp/vim_temp/' . $USER . '/'
if ! filewritable(s:tmp_path)
silent execute '!mkdir -p "' . s:tmp_path . '"'
else
" remove backups older than 8 days (-ctime +8)
silent execute '!find "' . s:tmp_path . '" -type f -ctime +8 -delete'
endif
@kaero
kaero / resources.xsd
Created May 26, 2011 09:36
resources.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://example.com/app/resources" xmlns="http://example.com/app/resources"
xmlns:res="http://example.com/app/resources">
<xs:complexType name="resource-description">
<xs:attribute name="src"/>
<xs:attribute name="media"/>
</xs:complexType>
@kaero
kaero / xslt20-with-resources.xsd
Created May 26, 2011 09:37
xslt20-with-resources.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:res="http://example.com/app/resources"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/XSL/Transform"
targetNamespace="http://www.w3.org/1999/XSL/Transform">
<xs:import namespace="http://example.com/app/resources" schemaLocation="resources.xsd"/>
<xs:redefine schemaLocation="http://www.w3.org/2007/schema-for-xslt20.xsd">
<!--
((_)->((_)->(->_--)(_--))(_))(0)
@kaero
kaero / uri.js
Created September 6, 2012 20:43 — forked from jlong/uri.js
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
/*
I've wrapped Makoto Matsumoto and Takuji Nishimura's code in a namespace
so it's better encapsulated. Now you can have multiple random number generators
and they won't stomp all over eachother's state.
If you want to use this as a substitute for Math.random(), use the random()
method like so:
var m = new MersenneTwister();