Skip to content

Instantly share code, notes, and snippets.

View wodor's full-sized avatar

Artur 'Wodor' Wielogorski wodor

View GitHub Profile
@wodor
wodor / nvidia-fan.sh
Created February 16, 2025 16:01
Control fan from nvidia-smi
#! /bin/bash
TEMP=$(nvidia-smi -q -d temperature | grep "GPU Current" | tail -n 1 | cut -d ":" -f 2 | cut -d " " -f 2)
DEVICE=/sys/devices/platform/nct6775.2608/hwmon/hwmon2/pwm1
echo 1 > /sys/devices/platform/nct6775.2608/hwmon/hwmon2/pwm1_enable
while true; do
TEMP=$(nvidia-smi -q -d temperature | grep "GPU Current" | tail -n 1 | cut -d ":" -f 2 | cut -d " " -f 2)
@wodor
wodor / Genny Installer
Last active January 23, 2023 08:08
Genny Installer
#!/usr/bin/env bash
expandPath() {
case $1 in
~[+-]*)
local content content_q
printf -v content_q '%q' "${1:2}"
eval "content=${1:0:2}${content_q}"
printf '%s\n' "$content"
;;
@wodor
wodor / pointers_and_interfaces.go
Last active October 27, 2021 09:41
Demonstrates how pointers work for methods with interfaces as parameters
package main
import "fmt"
func main() {
i := TheImplementation{Value: 0}
// simple, changes the value as expected
toPointer(&i)
fmt.Printf(" V: %d \n", i.Value)
@wodor
wodor / SketchSystems.spec
Created September 6, 2018 10:44
My Awesome Sketch
My Awesome Sketch
First State
some event -> Second State
Second State
@wodor
wodor / SketchSystems.spec
Created September 6, 2018 10:43
My Awesome Sketch
My Awesome Sketch
First State
some event -> Second State
Second State
<?php
use DOMDocument;
use DOMNode;
use eZ\Publish\API\Repository\ContentService;
use eZ\Publish\API\Repository\ContentTypeService;
use eZ\Publish\API\Repository\Repository;
use eZ\Publish\API\Repository\Values\Content\Field as ContentField;
use eZ\Publish\SPI\Persistence\Content as SPIContent;
use eZ\Publish\API\Repository\Values\Content\Content as APIContent;
<?php
use eZ\Publish\API\Repository\Values\Content\Search\Facet;
class IntervalFacet extends Facet
{
/**
* @var array
*/
public $entries;
%% initial_state return {ok, State} or {error, State}
%% before
play(Context) ->
play(Context, initial_state(Context)).
%% after
play(Context) ->
{ok, State} = initial_state(Context),
<?php
namespace WodorNet\Vindinium;
class Board
{
public function getSurroundingPassableTiles(Position $position)
{
foreach ($this->surroundingTiles($position) as $tile) {
if ($tile->isPassable()) {
function testRepositoryUsage()
{
$id = 42;
$value = array('results');
$repo = $this->getMock('Repository\FindsStuffInCity');
$repo->expects($this->once())
->method('findByCityId')
->with($id)
->will($this->returnValue($value));