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
blp_N = len(sources) | |
blp_X = np.array(blp_X) # (examples, sources) | |
blp_y = np.array(blp_y) # (examples as 1/0,) | |
def log_llh_blp(params, x, y): | |
a, b, w = params[0], params[1], params[2:] | |
hswp = st.beta.cdf(np.dot(x, w), a, b) | |
llh = scipy.special.xlogy(y, hswp) + scipy.special.xlogy(1.0 - y, 1.0 - hswp) | |
return -np.mean(llh) |
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
from sklearn.base import BaseEstimator, ClassifierMixin | |
import numpy as np | |
class DelphiClassifier(BaseEstimator, ClassifierMixin): | |
def __init__(self, base_clfs, output_model=None, rounds=3): | |
self.base_clfs = base_clfs | |
self.output_model = output_model | |
self.rounds = rounds | |
self.round_clfs = {} |
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
#!/bin/bash | |
sudo apt-get update && sudo apt-get upgrade -y | |
sudo apt-get install -y python3-pip python3-dev tmux nodejs npm nano net-tools htop ufw git curl less build-essential | |
sudo pip3 --upgrade pip install black requests | |
sudo npm install -g pm2 |
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
""" | |
Use this script to migrate notes from Samsung Notes to Google Keep. | |
1. Export notes from Samsung Notes as .pdf files | |
2. Copy those into the same folder as this script. | |
3. Open Google Keep in your browser | |
4. $ python samsungnotes2keep.py | |
You may need to ($ pip install keyboard pdfplumber) | |
""" | |
import pdfplumber |
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
(function(console){ | |
console.save = function(data{ | |
if(typeof data === "object"){ | |
data = JSON.stringify(data, undefined, 4); | |
} | |
var blob = new Blob([data], {type: 'text/json'}), | |
e = document.createEvent('MouseEvents'), | |
a = document.createElement('a'); | |
a.download = 'console.json' | |
a.href = window.URL.createObjectURL(blob); |
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
sudo apt update | |
sudo apt-get upgrade -y | |
sudo apt install openjdk-8-jre-headless tmux | |
sudo ufw allow 25565 | |
sudo ufw allow 22 | |
sudo ufw enable | |
java -Xmx1024M -Xms1024M -jar minecraft_server.1.16.2.jar nogui | |
https://launcher.mojang.com/v1/objects/c5f6fb23c3876461d46ec380421e42b289789530/server.jar | |
\u00A73\u00A7l\u25BC\u00A73\u00A7l Convergent \u00A7rMinecraft |
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
import React from 'react'; | |
import { ResponsiveLine } from '@nivo/line' | |
import logo from './logo.svg'; | |
import './App.css'; | |
let data = require('./data.json') | |
function App() { | |
return ( | |
<div className="App"> |
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
import json | |
import sys | |
import csv | |
def main(fn): | |
with open(fn, 'r', newline='') as csvfile: | |
reader = csv.DictReader(csvfile) | |
rows = [dict(row) for row in reader] | |
with open('data.json', 'w') as jsonfile: |
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/python | |
# -*- coding: utf-8 -*- | |
import glob | |
import os | |
import time | |
import smartcrop | |
from PIL import Image | |
from multiprocessing import Pool | |
import pickle |
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
import json | |
USERNAME = '<adminname>' | |
BACKUP = '<backup_file>.json' | |
def parse_item_json(item_json): | |
name = item_json['item']['type'] | |
amt = item_json['item'].get('amount', 1) | |
return name, amt |
NewerOlder