Skip to content

Instantly share code, notes, and snippets.

View ugwis's full-sized avatar

Yuta Kitamura ugwis

View GitHub Profile

Keybase proof

I hereby claim:

  • I am ugwis on github.
  • I am ugwis (https://keybase.io/ugwis) on keybase.
  • I have a public key ASB5kYm6xjaj4UVi6QQ0QlQ2UiTaIO_JqxKrsUAtOcmMXQo

To claim this, I am signing this object:

@ugwis
ugwis / friendly-process.c
Last active February 8, 2022 03:09
Visitors from the future
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/prctl.h>
#include <sys/wait.h>
#include <sys/param.h>
#include <unistd.h>
#define PR_NAME_LEN 15
@ugwis
ugwis / put.sh
Created December 18, 2019 07:24
#!/bin/bash
# リージョン
export AWS_DEFAULT_REGION=ap-northeast-1
# CloudWatchLogs設定
LogGroupName="test"
LogStreamName="test"
# CloudWatchLogsにPUTするメッセージ
@ugwis
ugwis / server.sh
Last active November 10, 2019 04:22
Shell Web Server
#!/bin/zsh
rm -f fifo0; rm -f fifo1; rm -f debug
function routine() {
while true
do
# Parse Request
http_method="";http_path="";http_version="";http_header=""; http_body="";
target="http_request_line"
while read line
do
@ugwis
ugwis / gist:8c3d6c95d919e2e1beb65dd57db36946
Created September 15, 2019 11:21
authorized_keys isucon
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDU9lL98FkRLPzG9bMVkabaO+j+K7eg2CyCZaRGkkzYu9JyRy9sZ65+W9mTxa4Vqk6631324vGJwqlAFBUYBKvh+F+NMFN5A8/JzemVPZWDDKNCXYCIKV8SBIPXsfZ1+hINLfl7FigN6MOFA81T1dtEHuCkcZtmh+7N6bPIrKvIlRwY+0pjI+nyPvjJVMOPN60NMkWF/2tW4mYDQMXWBmP6UBqaxtczNFY9+uV6y6HWXN8yp+olZezCqt+soN6tO7qcTLRKnzkaUbv2W4lkrTX215p2lsQpyK3XRzJngqWJLyDRAjk4qqdS5dHZE8UkSkKD/BIbuUxeuY3OCsYgZmph skp-6wec2vtjfuynjpqm493w
#include <bits/stdc++.h>
using namespace std;
int main(){
cout << "Hello,World" << endl;
return 0;
}
{ "type": "GeometryCollection",
"geometries": [
{ "type": "Point",
"coordinates": [100.0, 0.0]
},
{ "type": "LineString",
"coordinates": [ [101.0, 0.0], [102.0, 1.0] ]
}
]
}
int gcd(int a, int b){
if(b==0) return a;
if(a < b) swap(a,b);
return gcd(b,a%b);
}
#define lli long long int
#define mod 1e9+7;
lli modpow(lli x, lli n) {
if (n == 0) return 1;
cout << x << " " << n << endl;
lli y = modpow(x, n / 2);
if (n % 2) {
return y*y*x;
}
class UnionFind {
private:
vector<int> v;
public:
UnionFind(int n) {
for (int i = 0; i < n; i++) v.emplace_back(-1);
}
int root(int x) {
return v[x] < 0 ? x : v[x] = root(v[x]);
}