Skip to content

Instantly share code, notes, and snippets.

View nischalshrestha's full-sized avatar
🔨

Nischal Shrestha nischalshrestha

🔨
View GitHub Profile
@sanxiyn
sanxiyn / lisp.c
Created August 14, 2010 04:16
Lisp
#include <assert.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
enum type {
NIL,
@jimbojsb
jimbojsb / gist:1630790
Created January 18, 2012 03:52
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

@THeK3nger
THeK3nger / audio.py
Last active September 1, 2023 21:35
Python Wave Audio Loop
import os
import wave
import threading
import sys
# PyAudio Library
import pyaudio
class WavePlayerLoop(threading.Thread) :
"""
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active April 25, 2024 02:01
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

package rx.android.observables;
import rx.Observable;
import rx.Observable.OnSubscribe;
import rx.Subscriber;
import rx.android.subscriptions.AndroidSubscriptions;
import rx.functions.Action0;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@mansam
mansam / gist:9332445
Created March 3, 2014 19:13
Audio device detection w/ pyaudio
# lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 006: ID 05e3:0606 Genesys Logic, Inc. USB 2.0 Hub / D-Link DUB-H4 USB 2.0 Hub
Bus 001 Device 009: ID 1130:f211 Tenx Technology, Inc. TP6911 Audio Headset
# cat d.py
import pyaudio
@akavel
akavel / ast2xml.py
Created May 16, 2014 18:30
Python AST to XML (Python recipe). Converts Python ASTs to XML files for reading in other languages. http://code.activestate.com/recipes/578625-python-ast-to-xml/ Created by Ryan Gonzalez on Wed, 7 Aug 2013 (MIT) meta:license=mit
import ast, re, sys
from xml.dom import minidom
try:
from xml.etree import cElementTree as etree
except:
try:
from lxml import etree
except:
from xml.etree import ElementTree as etree
@xavriley
xavriley / deep_note.rb
Last active April 21, 2020 02:36
Recreating the THX sound with SonicPi
# THX Deep Note
# Second draft
# see http://www.earslap.com/article/recreating-the-thx-deep-note.html
time = 10
wait_time = (time / 3)
synths = []
rand_note = -> { rrand(note(:A2), note(:A4)) }
with_fx :normaliser, amp: 0.5 do
use_synth :dsaw
@xavriley
xavriley / wobwob.rb
Created June 10, 2014 21:30
Standalone Sonic Pi wobble bass
# Defining standalone wobble
# WOBBLE BASS
define :wob do |note, no_of_wobs, duration|
# using in_thread so we don't block everything
in_thread do
use_synth :dsaw
lowcut = note(:E1) # ~ 40Hz
highcut = note(:G8) # ~ 3000Hz
@xavriley
xavriley / auto_dubstep.rb
Created June 10, 2014 21:33
Auto generating dubstep with Sonic Pi
# DUBSTEP
# Combines ideas from my other gists
current_bpm = 140.0
use_bpm current_bpm
# WOBBLE BASS
define :wob do
use_synth :dsaw
lowcut = note(:E1) # ~ 40Hz
highcut = note(:G8) # ~ 3000Hz