Skip to content

Instantly share code, notes, and snippets.

View IceCereal's full-sized avatar
🔴
I need red electrical tape

IceCereal IceCereal

🔴
I need red electrical tape
  • A foreign anime land
View GitHub Profile
@IceCereal
IceCereal / Typeconvert_v2.md
Last active April 3, 2023 12:57
A (better-than-before) command line utility program written in python3 to convert numbers between different bases

Typeconvert_V2

  • Download the typeconvert gist.

  • Make it an executable - chmod 755 typeconvert

  • Move it into your path - ~/.local/bin/, /usr/local/bin/

  • You might have to close your terminal and open it again in order to use it

@IceCereal
IceCereal / Typeconvert.md
Last active April 3, 2023 12:57
A command line utility to convert a number of binary, octal, decimal or hexadecimal to the other three

Use Typeconvert_V2.

Typeconvert

Why can't I find a single and simple command line utility to convert a number in one base to another base.

Yeah, it's simple to make your own program or launch a python shell to get it to

@IceCereal
IceCereal / backup.sh
Last active July 12, 2020 17:51
A simple minecraft server backup utility shell script. Nothing fancy. You run this when you want to.
#!/bin/bash
# A simple minecraft server backup utility shell script.
# This is meant to be run when you want to; alternatively,
# you can cron job it.
# Requires pipe-viewer (pv) and bzip2
# This assumes a few things that may need to be replaced.
# 1. Variable minecraft is the directory to your minecraft server.
@IceCereal
IceCereal / capture-time-compress.sh
Created April 30, 2020 17:06
Record the time taken for compressing a file of size [0..2Mb..2.5Kb] using tar, gunzip and zip.
#!/bin/bash
# To run this:
# > create a file called program.sh
# > $ chmod +x program.sh
# > $ ./program.sh
# Note:
# > keep if=/dev/urandom if you want a randomized file
# > keep if=path/to/filename if you want a structured file (which is dependent on your file)
@IceCereal
IceCereal / DifferentialEvolution-Eggholder.py
Created March 3, 2020 07:10
A program to perform optimization through Differential Evolution on the Eggholder Function
# CS 313: Machine Learning
# Make a program to perform optimization through Differential Evolution on the Eggholder Function
# For a population of [20, 50, 100, 200]
# For [50, 100, 200] generations
# Also, plot the global minimum fitness and average fitness for each generation
# for each population size and generation
# Author: IceCereal
@IceCereal
IceCereal / RedditDataDownloader.py
Last active July 14, 2019 20:01
Reddit (Subreddit) Data Downloader. This one is configured to images, so the extensions are according to images. The Reddit (Subreddit) Data Saver is used to save data (Title, Content) to a particular directory.
"""
This is a downloader of data from a particular subreddit.
Change the `subredditName` to your desired subreddit and then
watch the things get downloaded. You need praw (at the time of
writing this, it's praw6) and wget to run this program.
Step 1: https://www.reddit.com/prefs/apps <- Make an Application
Get the client_id and client_secret
Step 2: Enter desired subreddit in subredditName
Step 3: Run the program
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import java.util.ArrayList;
from sklearn import linear_model
from matplotlib import pyplot as plt
x = [[2],[1],[5],[10]]
y = [27, 11, 75, 155]
LinearRegression = linear_model.LinearRegression()
LinearRegression = LinearRegression.fit(x,y)
plt.scatter(x,y)