Skip to content

Instantly share code, notes, and snippets.

@hyonschu
hyonschu / deleteDiscordMessages.js
Created July 11, 2019 19:36 — forked from victornpb/deleteDiscordMessages.js
Delete all your messages from DM or Channel in Discord
//Paste this function in DevTools console inside Discord
/**
* Delete all messages in a Discord channel or DM
* @param {string} authToken Your authorization token
* @param {string} authorId Author of the messages you want to delete
* @param {string} channelId Channel were the messages are located
* @param {string} afterMessageId Only delete messages after this, leave blank do delete all
* @author Victornpb <https://www.github.com/victornpb>
* @see https://gist.github.com/victornpb/135f5b346dea4decfc8f63ad7d9cc182
@hyonschu
hyonschu / README.md
Created April 26, 2016 03:49
Tufte Minimal Line Plot
@hyonschu
hyonschu / README.md
Created April 26, 2016 03:45
Tufte slopegraph
d3.csv('cancer_survival_rates.csv', function(csv) {
var dataset = []
for (var i=0; i<csv.length; i++) {
// console.log(data[i])
dataset.push( csv[i] )
}
// // layout variables
var pad = 50;
var hh = 1200;
// GO AHEAD AND POPULATE THE TEXT
var unstack = function(obj) {
var tmp = Math.round(obj);
if (tmplist.indexOf(tmp)>=0) {
while (tmplist.indexOf(tmp)>=0) {
tmp++
}
tmplist.push(tmp)
} else {
<!DOCTYPE html>
<html>
<head><meta charset="UTF-8">
<title>Page Titles</title>
<script src='lib/d3.min.js'>
</script>
<style>
div.bar {
display: inline-block;
width: 20px;
"""
this was done using make sysinstall on a Retina MacBook Pro 2015
"""
### in ipython ###
args = parser.parse_args()
### output
2016-02-15 10:59:21,891 - neon.backends.nervanacpu - WARNING - Problems inferring BLAS info, CPU performance may be suboptimal
chunk = '4\r\n 2000-2-18 cutomer: A3K605XFFC7NIA rating: 1 votes: 19 helpful: 12\r\n 2000-2-23 cutomer: A3E7NRYT2NPPD1 rating: 1 votes: 16 helpful: 13\r\n 2000-4-17 cutomer: A2V8O1IKTM6FXH rating: 4 votes: 7 helpful: 7\r\n 2000-4-27 cutomer: AJZ6R63Q8Y8XX rating: 4 votes: 9 helpful: 9\r\n 2000-5-16 cutomer: ALM383FHKU6DM rating: 5 votes: 8 helpful: 0\r\n 2000-7-19 cutomer: AH1YESR0CVI04 rating: 5 votes: 1 helpful: 1\r\n 2000-10-11 cutomer: A2JVHERZ91ZZ5Q rating: 4 votes: 7 helpful: 4\r\n 2000-12-4 cutomer: AQKZ1Q0UI740W rating: 5 votes: 17 helpful: 17\r\n 2001-8-26 cutomer: ASFY7TDEW608J rating: 5 votes: 13 helpful: 1\r\n 2002-7-1 cutomer: ANKFQMNL9E89N rating: 5 votes: 3 helpful: 3\r\n 2002-7-2 cutomer: A1OOI3Q34M6K8Q rating: 5 votes: 2 helpful: 2\r\n 2002-7-29 cutomer: A1Z4NWNR1XLM8U rating: 5 votes: 9 helpful: 9\r\n 2002-10-17 cutomer: A1K10NRS5J7IGO rating: 5 votes: 5
def wordcount(filename):
f=open(filename)
line = f.readline()
for word in line:
if word in dic:
dic[word] += 1
else:
dic[word] =1
return dic
def is_sorted(ary):
count = 0
while count < len(ary):
if ary[count] <= ary[count+1]:
count += 1
else:
return False
return True