Skip to content

Instantly share code, notes, and snippets.

View Joker-vD's full-sized avatar
🥄

Joker-vD

🥄
View GitHub Profile
#include <errno.h>
#include <fcntl.h>
#include <sys/select.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <pty.h>
#include <stdlib.h>
// Uncompressed version of
// https://gist.github.com/munificent/b1bcd969063da3e6c298be070a22b604
#include <time.h> // Robert Nystrom
#include <stdio.h> // @munificentbob
#include <stdlib.h> // for Ginny
#include <stdbool.h> // 2008-2019
const int HEIGHT = 40;
const int WIDTH = 80;
@Joker-vD
Joker-vD / quadratures.cs
Created July 16, 2019 22:54
Some horribly unoptimized quadrature rules, integrating the "black swan" function from Eric Lippert's "Fixing Random" series.
using System;
using System.Collections.Generic;
using System.Linq;
namespace Quadratures
{
interface Integrator
{
double Integrate(Func<double, double> f, double a, double b);
}
#!/bin/sh -e
NEW_USERNAME=joker
test -n "$NEW_USERNAME"
command -v sudo >/dev/null
test -x /bin/bash
adduser --shell=/bin/bash -- "$NEW_USERNAME"
adduser -- "$NEW_USERNAME" sudo
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <cstdio>
#include <cstring>
#include <stdexcept>
#include <string>
@Joker-vD
Joker-vD / MSVS_output_properties.md
Last active May 18, 2020 22:22
Separating src/obj/bin from each other
  • for C/C++ projects to have output in "Debug-x86" instead of "Debug-Win32":
 <PropertyGroup>
   <IntermediateOutputPath>$(SolutionDir)..\obj\$(Configuration)-$(Platform)\$(MSBuildProjectName)\</IntermediateOutputPath>
   <OutputPath>$(SolutionDir)..\bin\$(Configuration)-$(Platform)\</OutputPath>
   <IntDir>$(SolutionDir)..\obj\$(Configuration)-$(Platform)\$(MSBuildProjectName)\</IntDir>
   <OutDir>$(SolutionDir)..\bin\$(Configuration)-$(PlatformShortName)\</OutDir>
 </PropertyGroup>
@Joker-vD
Joker-vD / mh.py
Created July 28, 2020 18:32
Monty Hall simulation
import random
show_games = False
all_doors = [1, 2, 3]
def show(*args, **kwargs):
if show_games:
print(*args, **kwargs)
def player_chose_first_time():