Skip to content

Instantly share code, notes, and snippets.

View Helias's full-sized avatar
🏠
Working from home

Stefano Borzì Helias

🏠
Working from home
View GitHub Profile
@sxiii
sxiii / readme.md
Created March 4, 2021 19:40
How to launch games via Proton from CLI (useful for debug)

How to launch games via Proton from CLI (useful for debug)

In just 2 steps

First. Run this:

export STEAM_COMPAT_DATA_PATH=~/.local/share/Steam/steamapps/compatdata

Second. Now in the same terminal, run your game (this example: Raft)

~/.local/share/Steam/steamapps/common/Proton\ 5.13/proton run ~/.local/share/Steam/steamapps/common/Raft/Raft.exe

@sorny
sorny / x11_forwarding_macos_docker.md
Last active November 6, 2024 12:03
X11 forwarding with macOS and Docker

X11 forwarding on macOS and docker

A quick guide on how to setup X11 forwarding on macOS when using docker containers requiring a DISPLAY. Works on both Intel and M1 macs!

This guide was tested on:

  • macOS Catalina 10.15.4
  • docker desktop 2.2.0.5 (43884) - stable release
  • XQuartz 2.7.11 (xorg-server 1.18.4)
  • Macbook Pro (Intel)
@mmasashi
mmasashi / test_patch.py
Last active August 22, 2023 12:33
Behavior of mock, patch, pytest mocker, examples
import contextlib
import pytest
from unittest.mock import patch
class A(object):
def say(self, msg):
return f'A say {msg!r}.'
@contextlib.contextmanager
@nmarley
nmarley / README.md
Last active September 24, 2024 08:12
Go / C++ bindings example

Go / C++ bindings example

This is an example of Go code calling to a C++ library with a C wrapper.

Build

go build  # this only ensures it compiles
@max-mapper
max-mapper / upload.sh
Created March 27, 2019 00:43
upload large file to zenodo from command line (curl)
# in zenodo ui create a deposition. get the id
curl -H "Accept: application/json" -H "Authorization: Bearer $TOKEN" "https://www.zenodo.org/api/deposit/depositions/$DEPOSITION"
# get the bucket id from above
curl --progress-bar -o /dev/null --upload-file ./$FILE https://www.zenodo.org/api/files/$BUCKET/$FILE?access_token=$TOKEN
@Sarjuuk
Sarjuuk / convert.sh
Last active August 12, 2024 02:23
[*NIX] audio file conversion using ffmpeg - deletes after conversion
#!/bin/bash
find . -name "*.wav" | xargs -I % sh -c 'ffmpeg -hide_banner -y -i "%" -acodec libvorbis -f ogg "%_"; rm "%";' && find . -name "*.mp3" | xargs -I % sh -c 'ffmpeg -hide_banner -y -i "%" -acodec libmp3lame -f mp3 "%_"; rm "%";'
@soply
soply / disp_multiple_images.py
Last active January 9, 2024 14:52
Plot multiple images with matplotlib in a single figure. Titles can be given optionally as second argument.
import matplotlib.pyplot as plt
import numpy as np
def show_images(images, cols = 1, titles = None):
"""Display a list of images in a single figure with matplotlib.
Parameters
---------
images: List of np.arrays compatible with plt.imshow.
@DarrenN
DarrenN / get-npm-package-version
Last active October 25, 2024 17:37 — forked from yvele/get-npm-package-version.sh
Extract version from package.json (NPM) using bash / shell
# Version key/value should be on his own line
PACKAGE_VERSION=$(cat package.json \
| grep version \
| head -1 \
| awk -F: '{ print $2 }' \
| sed 's/[",]//g')
echo $PACKAGE_VERSION
@nickdavis
nickdavis / template-iframe.php
Created October 21, 2014 19:28
Add a 'full width' iFrame (WordPress) page template using a custom field for the iFrame URL and including Genesis scripts (if set) in the header
<?php
// Template Name: iFrame
/**
* Get the URL for the iFrame from a custom field
*
* @link http://www.billerickson.net/advanced-custom-fields-frontend-dependency/
*/
$url = esc_url( get_post_meta( get_the_ID(), 'iframe', true ) );
@jctosta
jctosta / screen_cheatsheet.markdown
Last active November 17, 2024 08:18
Screen Cheatsheet

Screen Quick Reference

Basic

Description Command
Start a new session with session name screen -S <session_name>
List running sessions / screens screen -ls
Attach to a running session screen -x
Attach to a running session with name screen -r