Skip to content

Instantly share code, notes, and snippets.

View nngogol's full-sized avatar

nngogol

View GitHub Profile
<!DOCTYPE html>
<html>
<head><title>SOUND</title></head>
<body>
<div>Frequence: <span id="frequency"></span></div>
<script type="text/javascript">
var audioCtx = new (window.AudioContext || window.webkitAudioContext)();
var oscillatorNode = audioCtx.createOscillator();
var gainNode = audioCtx.createGain();
@eevee
eevee / perlin.py
Last active May 29, 2025 13:08
Perlin noise in Python
"""Perlin noise implementation."""
# Licensed under ISC
from itertools import product
import math
import random
def smoothstep(t):
"""Smooth curve with a zero derivative at 0 and 1, making it useful for
interpolating.
@zhanglongqi
zhanglongqi / pyqt_model_view.py
Last active September 22, 2023 00:19
Example of how to use `QDataWidgetMapper` and `QAbstractTableModel` to customize your own widget and your own model.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from PyQt5.QtWidgets import (QWidget, QDataWidgetMapper,
QLineEdit, QApplication, QGridLayout, QListView)
from PyQt5.QtCore import Qt, QAbstractTableModel, QModelIndex
class Window(QWidget):
def __init__(self, parent=None):
@claymcleod
claymcleod / pycurses.py
Last active April 28, 2025 17:11
Python curses example
import sys,os
import curses
def draw_menu(stdscr):
k = 0
cursor_x = 0
cursor_y = 0
# Clear and refresh the screen for a blank canvas
stdscr.clear()
@protrolium
protrolium / ffmpeg.md
Last active June 24, 2025 11:30
ffmpeg guide

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

You can get the list of installed codecs with:

@domitry
domitry / Barnes-Hut.pde
Last active February 7, 2020 06:44
N-body simulation using Barnes-Hut method and Processing.
import java.awt.geom.Rectangle2D;
import java.awt.geom.Point2D;
public static final int FRAME_X = 1024;
public static final int FRAME_Y = 1024;
public static final int GENERATION_NUM = 4;
public static final int WALL_POWER = 10;
public static final int COFF_COULUMB = 1;
private ArrayList<Body> bodies;
@devoncrouse
devoncrouse / clean_audio.sh
Created May 7, 2013 17:02
Using Sox (http://sox.sourceforge.net) to remove background noise and/or silence from audio files (individually, or in batch).
# Create background noise profile from mp3
/usr/bin/sox noise.mp3 -n noiseprof noise.prof
# Remove noise from mp3 using profile
/usr/bin/sox input.mp3 output.mp3 noisered noise.prof 0.21
# Remove silence from mp3
/usr/bin/sox input.mp3 output.mp3 silence -l 1 0.3 5% -1 2.0 5%
# Remove noise and silence in a single command
@casschin
casschin / gist:1990245
Created March 7, 2012 01:16
Python webdriver api quick sheet
### Locating UI elements ###
# By ID
<div id="coolestWidgetEvah">...</div>
element = driver.find_element_by_id("coolestWidgetEvah")
or
from selenium.webdriver.common.by import By
element = driver.find_element(by=By.ID, value="coolestWidgetEvah")
# By class name: