This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @fileoverview Returns a JSON replacer and reviver function that allows for | |
* registered classes to be serialized and deserialized from JSON objects. | |
*/ | |
const __type = '__type' | |
const TYPENAME_MAP = 'Map' | |
type SerializableTypes = { | |
// eslint-disable-next-line @typescript-eslint/no-explicit-any |
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 7.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"PCT","CRIME","2000","2001","2002","2003","2004","2005","2006","2007","2008","2009","2010","2011","2012","2013","2014","2015","2016","2017","2018","2019" | |
"1","MISDEMEANOR POSSESSION OF STOLEN PROPERTY ","6","16","7","11","7","18","13","14","25","19","34","33","42","43","37","18","7","13","14","5" | |
"","MISDEMEANOR SEX CRIMES (4)","43","47","38","38","32","25","32","26","25","31","27","50","44","42","43","35","53","72","88","81" | |
"","MISDEMEANOR DANGEROUS DRUGS (1)","453","438","330","219","86","42","50","38","69","68","78","91","72","84","93","98","215","165","44","32" | |
"","MISDEMEANOR DANGEROUS WEAPONS (5) ","13","15","19","21","11","16","17","26","30","27","39","29","32","19","32","26","22","22","17","12" | |
"","PETIT LARCENY ","2617","2293","1884","1731","1852","1925","1851","1957","1948","1970","1702","1938","2119","2014","1863","1782","2014","1932","2537","2324" | |
"","ASSAULT 3 AND RELATED OFFENSES ","464","355","346","388","340","326","308","350","306","28 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_scoring_vector(self): | |
""" | |
Get a vector of values derived from the field used to score a tetromino | |
placement. | |
""" | |
heights = self.heights() | |
ediff1d = np.ediff1d(heights) | |
return np.array([ | |
self.count_gaps(), # Gap count | |
np.mean(heights), # Average height |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Server app script */ | |
const PORT = 5000 | |
// Dependencies. | |
const express = require('express') | |
const fs = require('fs') | |
const path = require('path') | |
const youtubeAudioStream = require('youtube-audio-stream') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Example processAudio() function */ | |
const processAudio = (buffer) => { | |
// Create offline context | |
const offlineAudioContext = new OfflineAudioContext( | |
1, buffer.length, buffer.sampleRate) | |
// Create buffer source | |
const bufferSource = offlineAudioContext.createBufferSource() | |
bufferSource.buffer = buffer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Express server app */ | |
const PORT = 5000 | |
// Dependencies. | |
const express = require('express') | |
const path = require('path') | |
const youtubeAudioStream = require('youtube-audio-stream') | |
const app = express() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Kmeans clustering algorithm heavily influenced by | |
# https://gist.github.com/iandanforth/5862470 | |
import random | |
def get_color_distance(rgb1, rgb2): | |
""" | |
Given two RGB color values, this returns the squared euclidean distance | |
between the two colors. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import pyautogui | |
import time | |
print("Enter words:") | |
words = input() | |
time.sleep(2) | |
pyautogui.typewrite(words, interval=0.05); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var out = function() { | |
var firstWord = ""; | |
var text = ""; | |
for (var i = 0; i < 9999; ++i) { | |
var firstWordElement = $(`#nhwMiddlegwt-uid-${i}`); | |
if (firstWordElement) { | |
firstWord = firstWordElement.innerHTML; | |
} | |
var textElement = $(`#nhwRightgwt-uid-${i}`); | |
if (textElement) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var bodyParser = require('body-parser'); | |
var crypto = require('crypto'); | |
app.use(bodyParser.urlencoded({ | |
extended: true, | |
verify: function(request, response, buffer, encoding) { | |
request.receivedHash = request.headers['x-hub-signature']; | |
request.computedHash = 'sha1=' + crypto.createHmac('sha1', | |
process.env.GITHUB_WEBHOOK_SECRET).update(buffer).digest('hex'); | |
} |
NewerOlder