Skip to content

Instantly share code, notes, and snippets.

View dmcyk's full-sized avatar

Damian Malarczyk dmcyk

View GitHub Profile
#!/bin/bash
sudo apt-get install php-fpm php-mysql
#!/bin/bash
sudo su -
echo 5 > /proc/sys/net/ipv4/route/gc_timeout
echo 5 > /proc/sys/net/ipv4/neigh/default/gc_stale_time
import SwiftyCurl
import Foundation
import CCurl
///// SwiftyCurl
var request = cURLRequest(url: URL(string: "https://jsonplaceholder.typicode.com/posts")!,
method: .get)
request.contentType = .json
@dmcyk
dmcyk / sat
Created January 8, 2017 22:39
p cnf 20 91
4 -18 19 0
3 18 -5 0
-5 -8 -15 0
-20 7 -16 0
10 -13 -7 0
-12 -9 17 0
17 19 5 0
-16 9 15 0
11 -5 -14 0
@dmcyk
dmcyk / setupLLVM.sh
Last active April 26, 2017 17:25
setupLLVM.sh
#!/bin/bash
ver=`lsb_release -r | awk '{print $2}'`
db=""
dbSrc=""
if [[ $ver == "14.04" ]]; then
db="http://apt.llvm.org/trusty/ llvm-toolchain-trusty-4.0 main"
dbSrc="http://apt.llvm.org/trusty/ llvm-toolchain-trusty-4.0 main"
elif [[ $ver == "15.10" ]]; then
db="http://apt.llvm.org/wily/ llvm-toolchain-wily-4.0 main"
@dmcyk
dmcyk / MSIwG_setup.sh
Last active April 27, 2017 18:58
MSIwG_setup
#!/bin/bash
errLogPath=".err.log"
exec 3>&1
exec > /dev/null 2> $errLogPath
echo "" > $errLogPath
function echoStd {
while (( "$#" )); do
echo $1 >&3
shift
@dmcyk
dmcyk / Swift_array_3vs4.swift
Last active May 19, 2017 14:08
Works fine with Swift 3, but with 4 (17 May 2017 snapshot) I get following error `'map' produces '[T]', not the expected contextual result type '[(Element)]'`
public extension Array where Element: FloatingPoint {
func normalized(scale: Element) -> [Element] {
guard let maxVal = self.max(), let minVal = self.min() else {
return []
}
let diff = maxVal - minVal
return self.map { val in
((val - minVal) / diff) * scale
}
}

Debugowanie

Konfiguracja gdb

  1. w engine/example w pliku CMakeLists.txt w linii ~20 zaczynającej się od SET(CMAKE_CXX_FLAGS zamień końcówkę linii ... -nostdinc++" na ... -nostdinc++ -g"
  2. zrób to samo ale w silniku (engine/src) około linii 44
  3. ponownie skompiluj silnik i swoją funkcję klienta
  4. z konsoli zainstaluj narzędzie gdb: sudo apt-get install gdb
  5. ze skryptu uruchamiającego silnik run.sh skopiuj linię zaczynającą się od export i wpisz w aktywnym oknie konsoli
  6. ze skryptu uruchamiającego skopiuj swoje argumenty (całość tekstu po ./GameEngine)
  7. pozostając w folderze silnika, w konsoli odpal gdb: gdb GameEngine
@dmcyk
dmcyk / nginx.sh
Last active December 21, 2017 16:57
#!/bin/bash
sudo apt-get install build-essential zlib1g-dev libpcre3 libpcre3-dev unzip libssl-dev
NPS_VERSION=1.12.34.3-stable
cd
wget https://github.com/pagespeed/ngx_pagespeed/archive/v${NPS_VERSION}.zip
unzip v${NPS_VERSION}.zip
cd ngx_pagespeed-${NPS_VERSION}/
NPS_RELEASE_NUMBER=${NPS_VERSION/beta/}
NPS_RELEASE_NUMBER=${NPS_VERSION/stable/}
import Foundation
class OtherObject {
var value: String = ""
deinit {
print("Other deinit")
}
}