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 / 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 <nicolas.rougier@inria.fr>
;;
;; 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 / main.js
Last active December 13, 2018 22:16 — forked from risacher/main.js
glue to make blessed (low-level API) work in browserify with xterm.js
const blessed = require("blessed");
window.onload = function () {
const term = new Terminal({
cols: 80,
rows: 24
});
term.open(document.body);
term.write('\x1b[31mWelcome to term.js!\x1b[m\r\n');
@tcyrus
tcyrus / devpostButton.css
Last active October 6, 2015 18:02 — forked from nealrs/demo.html
Devpost Hackathon Button
.devpostButton {
background-color: #2D9EB2;
border-color: #237A89;
color: white;
box-shadow: none;
border-radius: 2px;
transition: all 200ms ease-out;
display: inline-block;
border-style: solid;
border-width: 0 0 3px;
@tcyrus
tcyrus / sso.py
Last active August 29, 2015 14:22 — forked from an-empty-string/sso.py
"""
A wrapper for Intranet2's single sign-on system.
Here's a brief overview of how Iodine SSO works:
- you make a request token (with generate_token)
- you redirect the user to a URL containing that request token
- when the user allows access, they are redirected back to your application
with an access token in the "sso" parameter
- you verify the access token (with check_access_token_validity)
- if you need to, you can start a session to access the API and such