Skip to content

Instantly share code, notes, and snippets.

View tcyrus's full-sized avatar

Timothy Cyrus tcyrus

View GitHub Profile
@tcyrus
tcyrus / github-repo-link-getter.js
Created May 7, 2022 01:19 — forked from tkoz0/github-repo-link-getter.js
js code to get all github repo links on a page
import numpy
import tqdm
dataset_file = 'GoogleNews-vectors-negative300.bin'
output_file = 'dataset-trimmed.bin'
def read_dataset_header(f) -> tuple[int, int]:
line = bytearray()
@tcyrus
tcyrus / snowflake-id.sql
Last active May 25, 2021 09:20 — forked from beginor/snowflake-id.sql
Twitter Snowflake ID for PostgreSQL
CREATE SEQUENCE IF NOT EXISTS public.snowflake_id_seq
MINVALUE 0 MAXVALUE 1023
CYCLE;
ALTER SEQUENCE public.global_id_seq OWNER TO postgres;
-- 41 bits for time in milliseconds
-- (41 years of IDs from epoch)
-- 13 bits for the logical shard ID
-- 10 bits for the global auto-incrementing sequence (modulus 1024).
-- This means we can generate 1024 IDs, per shard, per millisecond
@tcyrus
tcyrus / servers.json
Last active August 8, 2023 22:49
Temporary Data Dump for Migration Purposes
[{"id":1,"os":"Raspbian","loc":"On-Site","desc":"My first server. Hosted www.tcyr.us and share.tcyr.us. Migrated to ec2-lamp to simplify setup and deployment.","icon":"fl-debian","name":"tardis","status":"retired","platform":"Raspberry Pi"},
{"id":2,"os":"Amazon Linux","loc":"N. Virginia","desc":"A legacy server from when my setup was really bad. Hosted www.tcyr.us and share.tcyr.us. Acted as an ok playground for SELinux while I was still on AWS Free Tier. Server did not have a proper hostname when in use. It's current name was assigned for identification reasons. Migrated to dewdrop when AWS Free Tier expired and prices increased.","icon":"fab fa-aws","name":"ec2-lamp","status":"retired","platform":"AWS EC2"},
{"id":3,"os":"Ubuntu 16.04 LTS (LEMP)","loc":"NYC1","desc":"A legacy server from when my setup was really bad, but slightly better than before. Hosted www.tcyr.us, share.tcyr.us, sheets.tcyr.us, git.tcy.us, and other services. This server did not have a name when in primary use. It's current name w
@tcyrus
tcyrus / nano.el
Created October 8, 2020 13:11 — forked from rougier/nano.el
A very minimal emacs configuration
;; nano.el -- A very minimal emacs
;; Usage: emacs -q -l nano.el
;;
;; Copyright (C) 2020 Nicolas .P Rougier
;;
;; Author: Nicolas P. Rougier <[email protected]>
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
@tcyrus
tcyrus / gist:0261a761f388d70c0ec583306b939ed6
Created September 19, 2020 16:24
GitHub Verification using keys.pub
BEGIN MESSAGE.
cHN7wExcEmylXDi 7suT7bNcw6LiOOz EJfkUwKl2Dz7hRL BlBBqDyzxCoV8fM
wAoqc3gjCt9sEGO 6hFUVNHcv9nTCKq 6Xr2MZHgg4hDMLs RMRua7hdnEiFHgv
D5jAVUVl5RbYTwU j0pURo79upsTgDn 0EKvJyEjsIyLdQo gZRqNvPRqQqRgZ1
iMwiNGUB6dm5vCI WeWrFyJQIIoRXlZ rdBnW21.
END MESSAGE.
@tcyrus
tcyrus / caffe-to-coreml-to-onnx.py
Created May 15, 2020 00:25
Potential way to Create ONNX models for waifu2x
# This should be able to convert the pre-trained models from lltcggie/waifu2x-caffe to ONNX
# Based on the onnx converter script:
# https://github.com/onnx/onnx-docker/blob/master/onnx-ecosystem/converter_scripts/caffe_coreml_onnx.ipynb
import os
import coremltools
import onnxmltools
models_dir = 'waifu2x-caffe/models/'
const { Client, RichEmbed } = require('discord.js');
const client = new Client();
const { Story } = require('inkjs');
const fs = require('fs');
const { Pool } = require('pg');
const pool = new Pool({
user: 'me',
host: 'localhost',
@tcyrus
tcyrus / calculate_extensions.rs
Last active March 24, 2020 22:38
Rewrite of Submitty's calculate_extensions.cpp in Rust
#[macro_use]
extern crate clap;
extern crate chrono;
use std::collections::BTreeMap;
use std::fs::{self, DirEntry, File};
use std::io::{BufRead, BufReader};
use std::path::Path;
use std::process;
lapis = require "lapis"
import Model from require "lapis.db.model"
import respond_to, capture_errors from require "lapis.application"
class Users extends Model
class Items extends Model
class extends lapis.Application
[index: "/"]: =>