Skip to content

Instantly share code, notes, and snippets.

View ChaosEngine's full-sized avatar
🚲
HTML5 game designing

Chaos ChaosEngine

🚲
HTML5 game designing
View GitHub Profile
@ChaosEngine
ChaosEngine / Makefile
Created February 5, 2015 22:32
Person.cpp:6:1: warning: ‘Person::name’ is initialized with itself [-Winit-self]
CC=g++
CCFLAGS=-Wall
LDFLAGS=-Wall
SOURCES=$(wildcard *.cpp)
OBJECTS=$(SOURCES:.c=.o)
TARGET=Ludziki
all: $(TARGET)
$(TARGET): $(OBJECTS)
@ChaosEngine
ChaosEngine / gist:96dee668e2c196fe1f4c
Last active August 29, 2015 14:16
docker-gentoo build
stage3_suffix="" # e.g. -hardened
dist="http://distfiles.gentoo.org/releases/amd64/autobuilds"
stage3="$(wget -O- ${dist}/latest-stage3-amd64${suffix}.txt | tail -n 1 | cut -f 1 -d ' ')"
echo "Downloading and extracting ${stage3}..."
echo "${dist}/${stage3}" -q
bunzip2 ${stage3} | tar xf -
# | busybox tar \
# --exclude="./etc/hosts" \
@ChaosEngine
ChaosEngine / portage-creation.sh
Last active August 29, 2015 14:17
portage-creation
PORTAGE_TARBALL="portage-latest.tar.xz"
wget http://distfiles.gentoo.org/snapshots/$PORTAGE_TARBALL /
mkdir -p /usr && xzcat /$PORTAGE_TARBALL | tar -xf - -C /usr \
&& mkdir -p /usr/portage/{distfiles,metadata,packages} \
&& chown -R portage:portage /usr/portage \
&& echo "masters = gentoo" > /usr/portage/metadata/layout.conf \
&& eselect news read new \
&& env-update \
&& rm -f /$PORTAGE_TARBALL
#!/bin/bash
apt-get -y install wget curl;
echo "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.6 main" | tee /etc/apt/sources.list.d/llvm.list \
&& wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | apt-key add - \
&& apt-get update
apt-get -y install cmake llvm-3.5 clang-3.5 lldb-3.6 lldb-3.6-dev libunwind8 libunwind8-dev gettext git
@ChaosEngine
ChaosEngine / docker environment
Created December 2, 2015 21:22
1.0.0.0-rc-update1 SqlClient FileNotFound
root@9856ce2fe6fa:~/EntityFramework.Docs/docs/getting-started/aspnet5/sample/src/EFGetStarted.AspNet5.ExistingDb# dnvm upgrade
It appears you don't have Mono available. Remember to get Mono before trying to run application.
Determining latest version
Latest version is 1.0.0-rc1-update1
dnx-mono.1.0.0-rc1-update1 already installed in /opt/DNX_BRANCH
Adding /opt/DNX_BRANCH/runtimes/dnx-mono.1.0.0-rc1-update1/bin to process PATH
Updating alias 'default' to 'dnx-mono.1.0.0-rc1-update1'
root@9856ce2fe6fa:~/EntityFramework.Docs/docs/getting-started/aspnet5/sample/src/EFGetStarted.AspNet5.ExistingDb# dnvm upgrade -r coreclr
Determining latest version
Latest version is 1.0.0-rc1-update1
@ChaosEngine
ChaosEngine / torvnc
Last active July 21, 2016 21:33
A Dockerfile that builds an image that starts VNC and loads a Tor browser
# DOCKER-VERSION 1.12.0-rc4
# Tor Over VNC
FROM ubuntu:14.04
RUN apt-get update
#RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
# We need sudo because some post install stuff runs with tor
RUN apt-get install -y python-software-properties software-properties-common python3-software-properties sudo wget
RUN add-apt-repository -y ppa:upubuntu-com/tor && apt-get update
@ChaosEngine
ChaosEngine / SessionExtensions.cs
Created May 2, 2017 17:38
SessionExtensions generic type
public static class SessionExtensions
{
public static void Set<T>(this ISession session, string key, T value)
{
session.SetString(key, JsonConvert.SerializeObject(value));
}
public static T Get<T>(this ISession session, string key)
{
var value = session.GetString(key);
@ChaosEngine
ChaosEngine / git-diff.patch
Created July 15, 2017 20:52
https://github.com/aspnet/Caching: dev 2.0.0 patch for building on *nix and Win
diff --git a/samples/MemoryCacheConcurencySample/MemoryCacheConcurencySample.csproj b/samples/MemoryCacheConcurencySample/MemoryCacheConcurencySample.csproj
index b024bae..c758d72 100644
--- a/samples/MemoryCacheConcurencySample/MemoryCacheConcurencySample.csproj
+++ b/samples/MemoryCacheConcurencySample/MemoryCacheConcurencySample.csproj
@@ -3,7 +3,8 @@
<Import Project="..\..\build\dependencies.props" />
<PropertyGroup>
- <TargetFrameworks>net461;netcoreapp2.0</TargetFrameworks>
+ <TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">net461</TargetFrameworks>
@ChaosEngine
ChaosEngine / Swashbuckle.AspNetCore-issue-600-repro.patch
Created February 22, 2018 21:07
Swashbuckle.AspNetCore/issues/600
diff --git a/test/WebSites/Basic/Basic.csproj b/test/WebSites/Basic/Basic.csproj
index f38e99c..a5c8cf7 100644
--- a/test/WebSites/Basic/Basic.csproj
+++ b/test/WebSites/Basic/Basic.csproj
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
- <TargetFramework>netcoreapp2.0</TargetFramework>
+ <TargetFramework>net461</TargetFramework>
@ChaosEngine
ChaosEngine / ParallelFor.cs
Created July 20, 2018 21:54
Parallel scheme to partition long calculation
async Task<double> ComputeStuffAsync(CancellationToken token)
{
var tsk = Task.Run(() =>
{
var sum = 0.0;
int DOP = 4;
Parallel.For(0, DOP - 1, new ParallelOptions { MaxDegreeOfParallelism = DOP, CancellationToken = token },
// Initialize the local states
() => (double)0.0,