Skip to content

Instantly share code, notes, and snippets.

View rekyuu's full-sized avatar
🏳️‍🌈
everyday it's fresh bread

rekyuu rekyuu

🏳️‍🌈
everyday it's fresh bread
View GitHub Profile
@rekyuu
rekyuu / net_client.py
Last active November 8, 2015 01:33
Basic socket communication in Python
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
host = socket.gethostname()
port = 4560
# Connects to the server.
s.connect((host, port))
print('Connected.')
@rekyuu
rekyuu / fizzbuzz.exs
Created November 18, 2015 03:08
Elixir fizzbuzz
fizzword = fn
(0, 0, _) -> "fizzbuzz"
(0, _, _) -> "fizz"
(_, 0, _) -> "buzz"
(_, _, n) -> n
end
fizzbuzz = fn (n) ->
fizzword.(rem(n, 3), rem(n, 5), n)
end
@rekyuu
rekyuu / bar
Created December 7, 2015 05:31
lemonbar example
#!/usr/bin/bash
~/.config/lemonbar/bar_clock \
| lemonbar \
-f "Hack:size=11" \
-F "#FF000000" \
-B "#FFFFFFFF" \
-g 1920x20+1600+0 \
wait
@rekyuu
rekyuu / ifttt.py
Last active March 27, 2021 04:37
weechat ifttt script
import weechat, requests
weechat.register("ifttt", "rekyuu", "1.0", "MIT", "IFTTT: Send push notifications to IFTTT.", "", "")
settings = {
"trigger": "",
"token": ""
}
@rekyuu
rekyuu / dictionary.ex
Last active August 29, 2017 09:14
Elixir Markov
defmodule Markov.Dictionary do
def new do
HashDict.new
end
def parse(dictionary, source) when is_binary(source) do
parse(dictionary, String.split(source))
end
def parse(dictionary, [word1, word2 | rest]) do
@rekyuu
rekyuu / src.js
Last active December 16, 2017 07:36
var glyphs = document.querySelectorAll("span.glyphicon-facetime-video");
[].forEach.call(glyphs, function(elem){
var row_link = elem.parentElement.parentElement.getAttribute("data-target");
var run_url = "https://www.speedrun.com" + row_link
elem.classList.remove("glyphicon")
elem.classList.remove("glyphicon-facetime-video")
elem.innerHTML = "<a href='" + run_url + "'>VOD</a>"
@rekyuu
rekyuu / updater.py
Last active May 21, 2018 03:23
Server / Website Uptime Updater for Telegram
from datetime import datetime
from time import localtime, strftime, sleep
from urllib.parse import urlparse
import telepot
import requests
import subprocess
import platform
import csv
import os
@rekyuu
rekyuu / erlangc.exs
Created September 18, 2018 15:31
Elixir ErlangC
defmodule ErlangC do
def factorial_of(0), do: 1
def factorial_of(n) when n > 0, do: n * factorial_of(n - 1)
def traffic_intensity(calls, reporting_period, average_handle_time) do
calls_per_hour = (60 / reporting_period) * calls
(calls_per_hour * (average_handle_time / 60)) / 60
end
def probability_call_waits(traffic_intensity, agents) do
using System;
namespace sandbox
{
class Program
{
static void Main(string[] args)
{
// Get the user input for both fractions.
Console.WriteLine("Specify the first fraction.");
@rekyuu
rekyuu / chika.sh
Last active October 20, 2020 10:30
Livestreaming Script
#!/bin/sh
# Usage: $ sh chika.sh -v TARGET_PATH [-i] [-t START_TIME] [-e EPISODE_NO] [-a AUDIO_TRACK] [-s SUBTITLE_TRACK] [-f]
# -v TARGET_PATH: Direct path to target file or directory to stream from.
# -i: Provide info about the file.
# -d: Run in debug mode, which prevents the stream from running and the playlist from being deleted.
# -t START_TIME: Start from specified time (as HH:MM:SS.MS).
# -e EPISODE_NO: Start from an episode number when a directory is provided.
# -a AUDIO_TRACK: Specify an audio track to use.
# -s SUBTITLE_TRACK: Use subs embedded in the video file. Optionally specify which subtitle track to use.