Skip to content

Instantly share code, notes, and snippets.

View Riey's full-sized avatar
🏫
I'm studying and working at the same time, so I may be slow to respond.

Riey

🏫
I'm studying and working at the same time, so I may be slow to respond.
  • South Korea
  • 08:20 (UTC +09:00)
View GitHub Profile
@Riey
Riey / prepare.sh
Last active February 2, 2020 03:11
termux prepare
#!/bin/bash
apt update && apt install -y wget bsdtar zsh
mkdir -p ~/zsh
curl -L git.io/antigen > ~/zsh/antigen.zsh
chsh -s zsh
@Riey
Riey / slice.rs
Created January 7, 2020 02:25
rust slice pat
fn main() {
#[derive(PartialEq, Debug)]
struct X(u8);
let xs: Vec<X> = vec![X(0), X(1), X(2)];
if let [start @ .., end] = &*xs {
// --- bind on last element, assuming there is one.
// ---------- bind the initial elements, if there are any.
assert_eq!(start, &[X(0), X(1)] as &[X]);
assert_eq!(end, &X(2));
@Riey
Riey / getline.rs
Last active January 28, 2020 01:19
use std::io::{self, BufRead};
use std::iter;
use itertools::Itertools;
fn get_line() -> String {
let mut buf = String::with_capacity(64);
io::stdin().lock().read_line(&mut buf).unwrap();
buf
}
@Riey
Riey / install.sh
Last active February 16, 2020 05:44
eraym-rs install
#!/bin/bash
apt update && apt install -y p7zip wget
wget -O eraym-rs-android.7z https://github.com/Riey/eraym-rs/releases/latest/download/eraym-rs-android.7z
7z x eraym-rs-android.7z -aoa
chmod +x ./eraym-rs
@Riey
Riey / vec_decl.rs
Last active November 8, 2020 17:06
주간문제 HashMap
use std::slice::SliceIndex;
use std::ptr::NonNull;
use std::ops::{Deref, DerefMut, Index, IndexMut};
use std::iter::FromIterator;
// 필드는 참고용이며 꼭 이렇게 안해도됨
pub struct Vec<T> {
ptr: NonNull<T>,
len: usize,
cap: usize,
@Riey
Riey / cm-2020.rs
Last active December 25, 2020 07:19
use time::{Date, Weekday};
fn main() {
let n = std::env::args().nth(1).unwrap().parse().unwrap();
let current_year = 2020;
let mut native = 0;
let mut bridge = 0;
for i in 0..n {
#include <cstdint>
#include <optional>
#include <string>
#include <vector>
#include <iostream>
using utf8 = std::u8string_view;
using utf8_iter = std::u8string_view::const_iterator&;
#define CONT_MASK 0b00111111
@Riey
Riey / PKGBUILD
Last active January 15, 2021 15:40
kime-bin-pkgbuild
# Maintainer: riey <creeper844@gmail.com>
pkgname=kime-bin
pkgver=0.4.1
pkgrel=1
pkgdesc="Korean IME"
url="https://github.com/Riey/kime"
conflicts=('kime')
provides=('kime')
depends=('gtk3' 'cairo' 'libxcb')
@Riey
Riey / PKGBUILD
Last active January 16, 2021 08:21
kime-git-pkgbuild
# Maintainer: riey <creeper844@gmail.com>
pkgname=kime-git
pkgver=0.4.1.184.gc9740f9
pkgrel=1
pkgdesc="Korean IME"
url="https://github.com/Riey/kime"
conflicts=('kime')
provides=('kime')
depends=('gtk3' 'cairo' 'libxkbcommon' 'libxcb' 'pango')
@Riey
Riey / main.java
Created January 28, 2021 12:26
jeditor
// Java Program to create a text editor using java
import java.awt.*;
import javax.swing.*;
import java.io.*;
import java.awt.event.*;
import javax.swing.plaf.metal.*;
import javax.swing.text.*;
class editor extends JFrame implements ActionListener {
// Text component