Skip to content

Instantly share code, notes, and snippets.

View AtnNn's full-sized avatar
:shipit:

Etienne Laurin AtnNn

:shipit:
View GitHub Profile
// A simple game engine
// #1: The state of the game
// Aliens starting positions
const aliens = [{x: 10, y: 10}, {x:20, y:5}, {x: 25, y:15}]
// Ship info
const ship = { x: 5, direction: 0 }
@AtnNn
AtnNn / build.sh
Created February 17, 2020 01:04
Build rtags on Windows
set -eu
# /mingw64/include conflicts with /usr/include
if [[ ! -e llvm-include ]]; then
mkdir -p llvm-include
pacboy files mingw-w64-x86_64-llvm mingw-w64-x86_64-clang |
perl -ne 'print "$1\n" if /\/mingw64\/include\/(.*)/' |
while read -r h; do
mkdir -p llvm-include/"$(dirname "$h")"
ln -s /mingw64/include/"$h" llvm-include/"$h"
@AtnNn
AtnNn / script.groovy
Created January 20, 2020 17:45
Jenkins groovy script; run command on each slave
// Run from https://jenkins/script
import hudson.util.RemotingDiagnostics;
cmd = 'def proc = ["conan", "--version"].execute(); proc.waitFor(); println proc.in.text';
for (slave in hudson.model.Hudson.instance.slaves) {
if (slave.name ==~ /^build-slave[0-9]/) {
println slave.name;
println RemotingDiagnostics.executeGroovy(cmd, slave.getChannel());
@AtnNn
AtnNn / sandbox.cc
Created July 11, 2019 10:26
Blog idea!
#include <string>
template <auto Name>
struct Int { private: int n; };
struct EI : Int<1>, virtual Int<2> {};
struct DI : virtual Int<2> {};
struct FI : EI, DI {};
struct DC { int a1; int a2; };
@AtnNn
AtnNn / plan.md
Created July 6, 2019 12:11
Nix on Windows

Nix on Windows

  • Native Nix
  • Built in Visual C++
  • No Mingw, MSYS or Cygwin
  • NTFS Nix store
  • Symbolic links

Nixpkgs on Windows

#!/bin/bash
set -eou pipefail
if [[ $# != 1 ]]; then
echo "Generates a shell script that reproduces the environment variables created by a batch file"
echo "Usage: $0 <path-to-batch-file>"
exit 1
fi
@AtnNn
AtnNn / github show all outdated diff comments.js
Created January 3, 2018 12:10 — forked from dennishall1/github show all outdated diff comments.js
Show all outdated diff comments on a pull request in Github -- Simulate clicking on all links that say "Show outdated"
$$('.btn-link.text-gray').forEach(function(item){
if(item.innerHTML.match(/Show outdated/)){
item.dispatchEvent(new MouseEvent('click', {
view: window,
bubbles: true,
cancelable: true
}));
}
});
git diff -U1 |
  perl -ne '
    if (m|^\+\+\+ b/(.*)|) { $name = $1 }
    if (m|^@@.*\+(\d+),(\d+)|) { $from = $1; $to = $from + $2; print "clang-format -lines=$from:$to -style=file -i $name\n" }
  ' |
  sh
@AtnNn
AtnNn / gist:1923ded0189de8c2c652bc425179eda6
Created November 28, 2017 10:43
Visual C++ SWITCH_ALL
#define SWITCH_ALL(value, ...) \
__pragma(warning(push)) \
__pragma(warning(error: 4061)) \
switch(value){ __VA_ARGS__ } \
__pragma(warning(pop))