Skip to content

Instantly share code, notes, and snippets.

@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) :
"""
@adamjohnson
adamjohnson / publickey-git-error.markdown
Last active July 9, 2024 09:54
Fix "Permission denied (publickey)" error when pushing with Git

"Help, I keep getting a 'Permission Denied (publickey)' error when I push!"

This means, on your local machine, you haven't made any SSH keys. Not to worry. Here's how to fix:

  1. Open git bash (Use the Windows search. To find it, type "git bash") or the Mac Terminal. Pro Tip: You can use any *nix based command prompt (but not the default Windows Command Prompt!)
  2. Type cd ~/.ssh. This will take you to the root directory for Git (Likely C:\Users\[YOUR-USER-NAME]\.ssh\ on Windows)
  3. Within the .ssh folder, there should be these two files: id_rsa and id_rsa.pub. These are the files that tell your computer how to communicate with GitHub, BitBucket, or any other Git based service. Type ls to see a directory listing. If those two files don't show up, proceed to the next step. NOTE: Your SSH keys must be named id_rsa and id_rsa.pub in order for Git, GitHub, and BitBucket to recognize them by default.
  4. To create the SSH keys, type ssh-keygen -t rsa -C "your_email@example.com". Th
@fperez
fperez / nbmerge.py
Created June 23, 2015 01:04
Merge/concatenate multiple IPython notebooks into one.
#!/usr/bin/env python
# Note, updated version of
# https://github.com/ipython/ipython-in-depth/blob/master/tools/nbmerge.py
"""
usage:
python nbmerge.py A.ipynb B.ipynb C.ipynb > merged.ipynb
"""
import io
@pezholio
pezholio / mapit.js
Last active July 7, 2019 10:53
Getting parliamentary constituencies from MapIt
// This assumes you have node-rest-client (https://www.npmjs.com/package/node-rest-client) installed and available in your NODE_PATH
var Client = require('node-rest-client').Client;
var postcode = 'SW1A1AA'; // Or whatever postcode you're looking for
var uri = 'https://mapit.mysociety.org/postcode/' + postcode;
var getConstituency = function(uri, callback) {
var client = new Client();
client.get(uri, function(data, response) {
constituencyCode = data.shortcuts.WMC;
@minrk
minrk / index.html
Last active April 13, 2021 05:36
JupyterHub cross-origin test
<html>
<head>
<title>JupyterHub CORS test</title>
<script
src="https://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous">
</script>
<style type="text/css">
input[type=text] {
@ex-preman
ex-preman / Code.gs
Last active March 21, 2024 03:44
CRUD Using Google Apps Script
function doGet(e) {
Logger.log(e);
var op = e.parameter.action;
var ss = SpreadsheetApp.open(DriveApp.getFileById("YOUR_SPREADSHEET_ID"));
var sn = "YOUR_SHEET_NAME";
var sheet = ss.getSheetByName(sn);
if (op == "insert")
return insert_value(e, sheet);