Skip to content

Instantly share code, notes, and snippets.

@Celeo
Celeo / App.js
Last active Mar 22, 2020
Simple example of using pullstate
View App.js
import React from 'react'
import { useStoreState } from "pullstate"
import { UIStore } from "./store"
function App() {
const name = useStoreState(UIStore, s => s.name)
const onChange = (event) => {
const newVal = event.target.value
UIStore.update(s => {
@Celeo
Celeo / script.js
Created Aug 29, 2018
Block posts and comments from Tildes users
View script.js
// ==UserScript==
// @name Block Tildes user comments
// @version 0.1
// @description Block Tildes comments
// @author github.com/Celeo
// @match https://tildes.net/*
// @grant none
// @require http://code.jquery.com/jquery-latest.js
// ==/UserScript==
@Celeo
Celeo / get_scopes.py
Created Apr 27, 2018
Preston: scope(s) for operationId
View get_scopes.py
def print_scopes_for_op_id(preston, op_id):
path = p._get_path_for_op_id(op_id)
print(f'Path for operationId "{op_id}" is "{path}"')
path_spec = p._get_spec()['paths'][path]
for key in path_spec:
if path_spec[key].get('security'):
print(f'"{path} :: {key}" requires scopes: ' + ', '.join(path_spec[key]['security'][0]['evesso']))
op_id = 'get_characters_character_id_stats'
View char_ids_from_names.py
import sqlite3
from preston.xmlapi import Preston
connection = sqlite3.connect('data.db')
cursor = connection.cursor()
cursor.execute('SELECT character_name FROM member')
character_names = [e[0] for e in cursor.fetchall()]
@Celeo
Celeo / ecm_calculations.html
Last active Oct 2, 2016
EVE Online ECM chance calculations
View ecm_calculations.html
<!DOCTYPE html>
<title>ECM Calculations</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.0.1/vue.js"></script>
<link href="http://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.7/css/materialize.min.css">
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.7/js/materialize.min.js"></script>
<body class="grey lighten-2">
<br><br><br><br>
<div class="container">
@Celeo
Celeo / pyg.py
Last active Sep 18, 2015 — forked from Synthetica9/pyg.py
An interpeter for pyg, the golfed python. Fully backwards compatible with python.
View pyg.py
# A golfed python 'accent'. Fully backwards compatible with python.
# NOT SUITED FOR DAY-TO-DAY PROGRAMMING!
# If you DO use it for a production (non-challenge/codegolf) program, I'm not
# responsible for anything bad that happens to you, your computer,
# your spare time, your code maintainability, any kittens that god might kill,
# or the tears of blood you will weep.
import sys
from math import *
@Celeo
Celeo / corp_applicant_notifications.py
Last active Jan 3, 2016
Uses the character's notification system to determine if there are any new applications to their corporation.
View corp_applicant_notifications.py
import eveapi
from datetime import datetime
api = eveapi.EVEAPIConnection()
def main():
auth = api.auth(keyID=raw_input('keyID: '), vCode=raw_input('vCode: '))
characterID = raw_input("Your Director/CEO's character name: ")
notifications = auth.char.Notifications(characterID=characterID)
applicants = []
@Celeo
Celeo / corp_POS_fuels_eveapi.py
Last active Jan 2, 2016
Use eveapi to determine time all corp POSs run out of fuel
View corp_POS_fuels_eveapi.py
import eveapi
from datetime import datetime
api = eveapi.EVEAPIConnection()
auth = api.auth(keyID=raw_input('Key ID: '), vCode=raw_input('vCode: '))
events = auth.char.UpcomingCalendarEvents()
print ''
for event in events.upcomingEvents:
@Celeo
Celeo / corp_POS_fuel.py
Created Jan 10, 2014
Use evelink to determine time all corp POSs run out of fuel
View corp_POS_fuel.py
import evelink
from datetime import datetime
eve = evelink.eve.EVE()
char_id = eve.character_id_from_name(raw_input('Enter your character name: '))
api = evelink.api.API(api_key=(raw_input('Key ID: '), raw_input('vCode: ')))
char = evelink.char.Char(char_id=char_id, api=api)
events = char.calendar_events()
print ''
@Celeo
Celeo / cpu_usage_render.py
Created Dec 5, 2013
Uses Pygal and Psutil to create a graph of CPU usage over 60 seconds.
View cpu_usage_render.py
import psutil
import pygal
from time import sleep
c = pygal.Line()
c.title = 'CPU Usage Over 1 Minute'
data = []
count = 0
print 'Starting ...'
while True: