Skip to content

Instantly share code, notes, and snippets.

View mk0x9's full-sized avatar

Mikhail Kuryshev mk0x9

  • Berlin, Germany
  • 07:47 (UTC +02:00)
View GitHub Profile
@mk0x9
mk0x9 / icfpc2012.ls
Created August 1, 2012 22:01
ICFPC 2012 submission
time_start = process.hrtime!
String::replaceAt = (idx, c) ->
@substr(0, idx) + c + @substr(idx + c.length)
PF = require \pathfinding
fs = require \fs
read-map = ->
arr = fs.readFileSync it, \ascii |> (.split \\n)
idx = 0
$ qmake-qt4 -spec linux-g++-32 && make
/usr/lib64/qt4/bin/uic aboutdialog.ui -o ui_aboutdialog.h
/usr/lib64/qt4/bin/uic settingsdialog.ui -o ui_settingsdialog.h
g++ -c -m32 -pipe -std=c++0x -O2 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -Wall -W -D_REENTRANT -fPIC -DSKYPETABNG_LIBRARY -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/lib64/qt4/mkspecs/linux-g++-32 -I. -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include -I. -I. -o mainwindow.o mainwindow.cpp
g++ -c -m32 -pipe -std=c++0x -O2 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -Wall -W -D_REENTRANT -fPIC -DSKYPETABNG_LIBRARY -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/lib64/qt4/mkspecs/linux-g++-32 -I. -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include -I. -I. -o x11int.o x11int.cpp
g++ -c -m32 -pipe -std=c++0x -O2 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buf
# http://stackoverflow.com/questions/9739654/rake-assetsprecompile-taking-extremely-long-to-complete
# nocompress
module Sass
module Rails
class CssCompressor
def compress(css)
css
end
end
$ ruby test_server.rb -e production -p 9000 -d
$ ab -n 5000 -c 1000 http://localhost:9000/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)
Completed 500 requests
Completed 1000 requests
def index
@rooms = Room.includes :user
result = []
@rooms.each do |room|
el1 = {}
el2 = {}
Room.column_names.each { |col| el1[col] = room.send col }
User.column_names.each { |col| el2[col] = room.user.send col }
result << el1.merge(user: el2)
@mk0x9
mk0x9 / annoying_keys_unity_2d.diff
Created November 9, 2011 18:44
Disable annoying hotkeys in unity 2d
diff -Naur unity-2d.orig//unity-2d-4.12.0/launcher/app/launcherview.cpp unity-2d/unity-2d-4.12.0/launcher/app/launcherview.cpp
--- unity-2d.orig//unity-2d-4.12.0/launcher/app/launcherview.cpp 2011-09-29 18:12:44.000000000 +0400
+++ unity-2d/unity-2d-4.12.0/launcher/app/launcherview.cpp 2011-11-09 23:00:07.008801565 +0400
@@ -164,7 +164,7 @@
/* If the key is released, and was not being held, it means that the user just
performed a "tap". Unless we're told to ignore that tap, that is. */
if (!m_superKeyHeld && !m_superPressIgnored) {
- Q_EMIT superKeyTapped();
+ //Q_EMIT superKeyTapped();
}
@mk0x9
mk0x9 / direction.hs
Created October 23, 2011 13:37
Direction
entity2order :: Ant -> Point -> [Order]
entity2order a food = let xant = snd.point $ a
yant = fst.point $ a
xfood = snd food
yfood = fst food
in case compare xant xfood of
GT -> map (Order a) (directionClockWise West)
LT -> map (Order a) (directionClockWise East)
EQ -> case compare yant yfood of
GT -> map (Order a) (directionClockWise North)
(defun ac-go-candidates ()
(ac-go-autocomplete))
(defvar ac-source-go
'((candidates . ac-go-candidates)
(prefix . "\\.\\(.*\\)")
(requires . 0)))
(defun ac-go-get-candidate-strings (tmpbuf)
(split-string (with-current-buffer tmpbuf (buffer-string)) "\n"))
package main
import "fmt"
func main() {
var x byte
for {
fmt.Scan("%c", &x)
fmt.Printf("\nGot: '%c'\n", x)
}
cirno@perfect-math-class ~/sources/gollvm $ make
CGOPKGPATH= cgo -- `llvm-config --cflags` core.go executionengine.go target.go transforms_scalar.go transforms_ipo.go analysis.go bitwriter.go
error: 'LLVMInitializeCppBackendTargetInfo' undeclared (first use in this function)
error: (Each undeclared identifier is reported only once
error: 'LLVMInitializeARMTargetInfo' undeclared (first use in this function)
error: 'LLVMInitializeCellSPUTarget' undeclared (first use in this function)
error: 'LLVMInitializePowerPCTargetInfo' undeclared (first use in this function)
error: 'LLVMInitializeCBackendTargetInfo' undeclared (first use in this function)
error: 'LLVMInitializeAlphaTargetInfo' undeclared (first use in this function)
error: 'LLVMInitializeMBlazeTargetInfo' undeclared (first use in this function)