Skip to content

Instantly share code, notes, and snippets.

View natj's full-sized avatar

Joonas Nättilä natj

View GitHub Profile
@hamidzr
hamidzr / sof-audio-setup-carbonx1.sh
Last active June 2, 2023 01:43
Lenovo Carbon X1 Gen 7 - Audio and microphone fix - https://wiki.archlinux.org/index.php/Lenovo_ThinkPad_X1_Carbon_(Gen_7) might be all you need.
#!/bin/bash
# README You probablyl don't need this script anymore. Please read the comments below to catch up.
## Description
# Lenovo Carbon X1 Gen 7 - Audio and microphone fix - kernel 5.3+ required.
# The script has only been tested for Arch and OpenSuse,
# Original thread: https://forums.lenovo.com/t5/Ubuntu/Guide-X1-Carbon-7th-Generation-Ubuntu-compatability/td-p/4489823
# Prereq: Install Linux 5.3 or newer
@charlietran
charlietran / TerminalVim.scpt
Last active June 19, 2024 09:37
Open file in iTerm vim for MacOS Sierra
-- TerminalVim.app
-- This creates a shim Application that will enable you to open files from the Finder in vim using iTerm
-- To use this script:
-- 1. Open Automator and create a new Application
-- 2. Add the "Run Applescript" action
-- 3. Paste this script into the Run Applescript section
-- 4. Save the application as TerminalVim.app in your Applications folder
-- 5. In the Finder, right click on a file and select "Open With". In that window you can set TerminalVim as a default
@markmoser
markmoser / GollumGuard.md
Last active February 11, 2024 10:22
A gollum workflow

Gollum Guard

Gollumn requires changes to be commited before the server will pick them up for display.

This is a simple workflow that uses guard livereload to continually amend a sessions commit while you work with local files in your gollum wiki. You can use this with any guard task, really, but I like live reload to refresh my broswer.

For live reload to work, you need the extension installed in your browser

@gka
gka / make-animated-gifs-using-ffmpeg.md
Last active January 16, 2024 22:03
how to make a nice GIF from png frames

Make sure ffmpeg is up-to-date:

brew update
brew upgrade ffmpeg

Convert a MOV into frames. Tweak the 2/1 if you want more or fewer frames.

@graphitemaster
graphitemaster / WORKING_AROUND_OFFSETOF_LIMITATIONS.MD
Last active June 3, 2024 08:05
Working around offsetof limitations in C++

Working around offsetof limitations in C++:

There is sometimes a situation in which one needs to get the relative offset of a structure field, common examples of this include serialization frameworks which aid to serialize objects, vertex attributes for rendering (D3D, GL.), etc.

The most common technique for getting this information is through the offsetof macro defined in stddef.h. Unfortunately using the macro in C++ comes with a new set of restrictions that prevent some (subjectively valid) uses of it.

@fasiha
fasiha / overlapadd2.py
Last active March 31, 2023 19:49
Python/Numpy overlap-add method of fast 2D convolution. Public domain.
import numpy as np
from numpy.fft import fft2, ifft2
def overlapadd2(Amat, Hmat, L=None, Nfft=None, y=None, verbose=False):
"""
Fast two-dimensional linear convolution via the overlap-add method.
The overlap-add method is well-suited to convolving a very large array,
`Amat`, with a much smaller filter array, `Hmat` by breaking the large
@myusuf3
myusuf3 / delete_git_submodule.md
Created November 3, 2014 17:36
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@gizmaa
gizmaa / Plot_Examples.md
Last active June 10, 2024 02:44
Various Julia plotting examples using PyPlot
@rmcgibbo
rmcgibbo / MPI_ManualReduce.cpp
Last active August 16, 2022 23:15
Efficient MPI Parallel Reduction Without MPI_Reduce or MPI_Scan (only Send/Recv)
/*
* An efficient MPI parallel reduction without MPI_Scan or MPI_Reduce. (i.e.
* only send/recv).
*
* TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
* 0. You just DO WHAT THE FUCK YOU WANT TO.
*/
#include <mpi.h>
#include <cstdio>
#include <vector>
@fredRos
fredRos / PKG-INFO
Last active May 18, 2024 15:48
Minimal example to demonstrate how to use the sampler written in python to sample from a class method defined in C++. It also shows how get it to run with mpi4py to run on hundreds of processors.
Metadata-Version: 1.0
Name: fred_emcee_swig
Version: 1.0
Summary: UNKNOWN
Home-page: UNKNOWN
Author: UNKNOWN
Author-email: UNKNOWN
License: UNKNOWN
Description: UNKNOWN
Platform: UNKNOWN