Skip to content

Instantly share code, notes, and snippets.

View cicorias's full-sized avatar

Shawn Cicoria cicorias

View GitHub Profile
@cicorias
cicorias / addIssues.sh
Created November 5, 2020 03:04
create GitHub issues from the command line with a file
#!/usr/bin/env bash
filename='reqs.txt'
echo Start
while read p; do
title=$(echo "$p" | cut -d, -f1)
body=$(echo "$p" | cut -d, -f2)
gh issue create --title "$title" --body "$body" --label "enhancement"
done < $filename
@cicorias
cicorias / progress.java
Created October 11, 2020 13:26
java progress bar system console
public static void progressPercentage(int remain, int total) {
if (remain > total) {
throw new IllegalArgumentException();
}
int maxBareSize = 10; // 10unit for 100%
int remainProcent = ((100 * remain) / total) / maxBareSize;
char defaultChar = '-';
String icon = "*";
String bare = new String(new char[maxBareSize]).replace('\0', defaultChar) + "]";
StringBuilder bareDone = new StringBuilder();
@cicorias
cicorias / freeze_example.py
Created September 27, 2020 18:03 — forked from L0SG/freeze_example.py
PyTorch example: freezing a part of the net (including fine-tuning)
import torch
from torch import nn
from torch.autograd import Variable
import torch.nn.functional as F
import torch.optim as optim
# toy feed-forward net
class Net(nn.Module):
def __init__(self):
@cicorias
cicorias / union_find.py
Created July 14, 2020 00:15 — forked from artkpv/union_find.py
Union-Find in Python (weighted, path compression, connected components)
class UnionFind:
"""Weighted quick-union with path compression and connected components.
The original Java implementation is introduced at
https://www.cs.princeton.edu/~rs/AlgsDS07/01UnionFind.pdf
>>> uf = UnionFind(10)
>>> for (p, q) in [(3, 4), (4, 9), (8, 0), (2, 3), (5, 6), (5, 9),
... (7, 3), (4, 8), (6, 1)]:
... uf.union(p, q)
@cicorias
cicorias / .zshrc
Created June 29, 2020 21:26
dotfiles zshrc with theme on IX
# If you come from bash you might have to change your $PATH.
export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/Users/cicorias/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
@cicorias
cicorias / base.html
Last active June 17, 2020 22:49
Djange base.html
{% load static %}
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>
{% block title %}
{% endblock %}
git config --unset core.filemode
git config --global core.filemode false
@cicorias
cicorias / fm-unshit.sh
Created June 17, 2020 13:18
filemode shit old mode 100644 new mode 100755
git config --unset core.filemode
git config --global core.filemode false
@cicorias
cicorias / p.py
Created June 3, 2020 22:48
using choice fields
from django.db import models
class BakedGood(models.Model):
name = models.CharField(max_length=64)
desc = models.CharField(max_length=256)
good_type = models.TextChoices('type', 'BAGEL BREAD COOKIE CAKE PRETZEL')
sTypes = models.CharField(blank=True, choices=good_type.choices, max_length=20)
price = models.DecimalField(max_digits=6, decimal_places=2)
recipe = models.TextField()

OpenSSL Playground

Verify downloaded file
➜  openssl dgst -sha256 openssl-1.1.1.tar.gz
SHA256(openssl-1.1.1.tar.gz)= 2836875a0f89c03d0fdf483941512613a50cfb421d6fd94b9f41d7279d586a3d
➜  cat openssl-1.1.1.tar.gz.sha256
2836875a0f89c03d0fdf483941512613a50cfb421d6fd94b9f41d7279d586a3d
RSA Public Key pad and encrypt