Skip to content

Instantly share code, notes, and snippets.

View jellyfish26's full-sized avatar

jellyfish26

View GitHub Profile
@jellyfish26
jellyfish26 / init.vim
Last active August 21, 2021 16:27
Neovim config
"Dein Scripts
if &compatible
set nocompatible
endif
set runtimepath+=$HOME/.cache/dein/repos/github.com/Shougo/dein.vim
" Required:
if dein#load_state('$HOME/.cache/dein')
call dein#begin('$HOME/.cache/dein')
@jellyfish26
jellyfish26 / 5-9.c
Last active July 22, 2020 18:47
5-9
#include <stdio.h>
#define MAX_STUDENT 100
int max(int a, int b) {
if (a < b) return b;
else return a;
}
int main() {
@jellyfish26
jellyfish26 / huffman_encryption.py
Created July 15, 2020 17:44
Huffman Encryption
import graphviz
import heapq
import copy
import math
source_information = []
r = 2
def input_information():
@jellyfish26
jellyfish26 / GA_experiment.cs
Created June 17, 2020 15:47
GA experiment on C#
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Transactions;
using MyGAEnvironments;
@jellyfish26
jellyfish26 / GA_experiment.cpp
Last active June 17, 2020 15:48
GA experiment on C++17
#include <iostream>
#include <random>
#include <set>
#include <vector>
#include <algorithm>
class Environment1 {
public:
static double fitness(const std::string& check) {
double ret = 0;
@jellyfish26
jellyfish26 / entropy_of_markov_sources.cpp
Created June 10, 2020 11:57
マルコフ情報源のエントロピーを求める (Calculating the entropy of Markov sources)
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<string> state_name(N);
for (int i = 0; i < N; i++) cin >> state_name[i];
vector<pair<int, int>> stationary_probability(state_name.size());
for (int i = 0; i < state_name.size(); i++) {
@jellyfish26
jellyfish26 / leap_year_assembler.c
Created June 3, 2020 09:27
The leap year determination is written by inline assembler.
#include <stdio.h>
int main (int argc, char **argv) {
int year = 0, check = 0;
scanf("%d", &year);
char ok[] = "leap", ng[] = "not leap";
__asm__ volatile("mov %%rcx, %%rax;\n\t"
"mov $400, %%rbx;\n\t"
"idiv %%rbx;\n\t"
import socket
from sympy import * # noqa
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('zerois-o-reiwa.seccon.jp', 23615))
x = symbols('x')
while True:
number = s.recv(2048)
print('number is', number)
@jellyfish26
jellyfish26 / file0.txt
Last active August 3, 2018 11:50
機械学習・解析(音声解析)のための微分・積分(関数の極限) ref: https://qiita.com/jellyfish_26/items/c83968400087a629638f
\begin{align}
x&=1\\
x&=0.1\\
x&=0.01\\
&\vdots
\end{align}
#include <iostream>
#include <vector>
#include <algorithm>
std::vector<int> search_array;
bool binary_search(int search_value) {
int lower_range = 0, higher_range = (int)search_array.size() - 1;
while (higher_range >= lower_range) {
int median = lower_range+ (higher_range - lower_range) / 2;