Skip to content

Instantly share code, notes, and snippets.

View roma-guru's full-sized avatar
🌴
In Cyprus

Roman Voropaev roma-guru

🌴
In Cyprus
View GitHub Profile
@madskjeldgaard
madskjeldgaard / supercollider2live.scd
Last active July 3, 2024 10:21
SuperCollider to Ableton Live setup

/*

This small patch is an example of how to nicely send midi to Ableton Live from SuperCollider.

It includes how to set up Ableton Link (don't forget to press the "LINK" button in Live) and play a pattern using Link and midi.

It is assumed that you do this on MacOS and you have created a midi driver called "IAC Driver".

*/ (

@jbaranski
jbaranski / ffmpeg_mac_m1_record_cmd_line.md
Last active April 27, 2024 17:31
ffmpeg record screen on Mac M1 chip via command line

ffmpeg record screen on Mac M1 chip via command line

  1. Install ffmpeg.

brew install ffmpeg

  1. Figure out which device to use.

ffmpeg -f avfoundation -list_devices true -i ""

Ouput will look like:

@hzhan147
hzhan147 / install-cudnn.sh
Created March 15, 2019 07:16
Install CUDNN for CUDA 10.1
#Download deb file from :
# https://developer.nvidia.com/compute/machine-learning/cudnn/secure/v7.5.0.56/prod/10.1_20190225/Ubuntu14_04-x64/libcudnn7_7.5.0.56-1%2Bcuda10.1_amd64.deb
# https://developer.nvidia.com/compute/machine-learning/cudnn/secure/v7.5.0.56/prod/10.1_20190225/Ubuntu14_04-x64/libcudnn7-dev_7.5.0.56-1%2Bcuda10.1_amd64.deb
sudo dpkg -i libcudnn7_7.5.0.56-1+cuda10.1_amd64.deb
sudo dpkg -i libcudnn7-dev_7.5.0.56-1+cuda10.1_amd64.deb
@brandonwillard
brandonwillard / .pdbrc
Last active April 29, 2020 00:12
A `.pdbrc` that enables IPython's pretty printing in `[i]pdb`
#
# Make `pp` use IPython's pretty printer, instead of the standard `pprint` module.
#
# Sources: https://nedbatchelder.com/blog/200704/my_pdbrc.html
#
# XXX: This .pdbrc is only valid for Python >= 3.4
#
import pdb
import inspect as __inspect
from pprint import pprint as __pprint
@RamseyK
RamseyK / dyld_image_list.c
Last active December 25, 2020 12:44
Example code for retrieving loaded libraries using functions in dyld.h
#include <mach-o/dyld.h>
char *target_image_name = "libdyld";
const struct mach_header* target_mach_header = NULL;
const char *image_name = NULL;
int num_images = _dyld_image_count();
printf("%i images loaded\n", num_images);
for (int i = 0; i < num_images; i++) {
@timvisee
timvisee / falsehoods-programming-time-list.md
Last active July 21, 2024 05:06
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
@gbaman
gbaman / graphql_example.py
Created November 1, 2017 00:18
An example on using the Github GraphQL API with Python 3
# An example to get the remaining rate limit using the Github GraphQL API.
import requests
headers = {"Authorization": "Bearer YOUR API KEY"}
def run_query(query): # A simple function to use requests.post to make the API call. Note the json= section.
request = requests.post('https://api.github.com/graphql', json={'query': query}, headers=headers)
if request.status_code == 200:
@Artiomio
Artiomio / keyboard_fly.py
Last active October 11, 2021 11:21
Python Linux/Windows async keyboard library - non-blocking keyboard input - read one character at a time
from __future__ import print_function
try:
import msvcrt
def key_pressed():
return msvcrt.kbhit()
def read_key():
key = msvcrt.getch()
import hashlib
from functools import wraps
from django.core.cache import cache
from django.utils.encoding import force_text, force_bytes
def cache_memoize(
timeout,
prefix='',
@flaviocopes
flaviocopes / check-substring-starts-with.go
Last active June 23, 2024 09:05
Go: check if a string starts with a substring #golang
package main
import (
"strings"
)
func main() {
strings.HasPrefix("foobar", "foo") // true
}