Skip to content

Instantly share code, notes, and snippets.

View Tryum's full-sized avatar

Thibault Jochem Tryum

  • Toulon, France
  • 05:11 (UTC +02:00)
  • X @tryumk
View GitHub Profile
---
- hosts: all
become: true
become_user: root
tasks:
- name: Get the list of services
service_facts:
- name: Disable ModemManager service
# %%
import json
import pandas as pd
import matplotlib.pyplot as plt
from datetime import datetime
def datetime_from_js_isoformat(string: str) -> datetime:
"""Creates a datetime object from a JavaScript ISO format string."""
if string.endswith('Z'):
cmake_minimum_required(VERSION 3.5)
project (Codingame)
#add_executable(nonogram-inversor puzzle/nonogram-inversor.cpp)
#add_executable(ocean-of-code contest/ocean-of-code.cpp)
add_executable(spring-challenge-2020 contest/spring-challenge-2020.cpp)
@Tryum
Tryum / boxstarter.ps1
Last active November 12, 2018 14:40
Unattended install of windows dev machine.
# Configure Windows
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions -EnableShowFullPathInTitleBar
# Allow running PowerShell scripts
Update-ExecutionPolicy Unrestricted
# Allow unattended reboots
$Boxstarter.RebootOk=$false
$Boxstarter.AutoLogin=$false
@Tryum
Tryum / async.cpp
Created June 18, 2018 15:06
Calling co_await on an IAsyncAction with a Completed handler attached throws a hresult_illegal_delegate_assignment
#pragma comment(lib, "windowsapp")
#include <chrono>
#include <winrt/base.h>
using namespace std::chrono_literals;
using namespace winrt;
using namespace winrt::Windows::Foundation;
IAsyncAction foo()
<Style x:Key="SliderStyle1" TargetType="Slider">
<Setter Property="Background" Value="{ThemeResource SliderTrackFill}"/>
<Setter Property="BorderThickness" Value="{ThemeResource SliderBorderThemeThickness}"/>
<Setter Property="Foreground" Value="{ThemeResource SliderTrackValueFill}"/>
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}"/>
<Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}"/>
<Setter Property="ManipulationMode" Value="None"/>
<Setter Property="UseSystemFocusVisuals" Value="True"/>
<Setter Property="FocusVisualMargin" Value="-7,0,-7,0"/>
<Setter Property="IsFocusEngagementEnabled" Value="True"/>
@Tryum
Tryum / .sh
Created November 29, 2017 13:22
google ping
function ping_gw() {
ping -c 1 google.com > /dev/null && return 0 || return 1
}
@Tryum
Tryum / stats.py
Created January 27, 2017 15:42
output raspberry pi stats as json.
import json
import subprocess
temp = subprocess.check_output('cat /sys/class/thermal/thermal_zone0/temp | cut -c1-2', shell=True)
load = subprocess.check_output("uptime | awk '{print $10}' | head -c-2", shell=True)
mem_total = subprocess.check_output("free |grep 'Mem:' | awk '{print $2}'", shell=True)
mem_used = subprocess.check_output("free |grep 'Mem:' | awk '{print $3}'", shell=True)
disk_total = subprocess.check_output("df | grep '/' | awk '{print $2}'", shell=True)
disk_used = subprocess.check_output("df | grep '/' | awk '{print $3}'", shell=True)
@Tryum
Tryum / Dockerfile
Last active May 3, 2018 09:15 — forked from prateekgogia/Dockerfile
Dockerfile to build 32 bit Docker container, for 32 bit docker daemon dev
# This file describes the standard way to build Docker, using docker
#
# Usage:
#
# # Assemble the full dev environment. This is slow the first time.
# docker build -t docker .
#
# # Mount your source in an interactive container for quick testing:
# docker run -v `pwd`:/go/src/github.com/docker/docker --privileged -i -t docker bash
#
export $(xargs -0 -n1 < /proc/1/environ)