Skip to content

Instantly share code, notes, and snippets.

View kira924age's full-sized avatar

Akira Kunishige kira924age

View GitHub Profile
@kira924age
kira924age / ReadMe.md
Last active December 4, 2022 04:01
Visualization of Simple Solving A Maze (DFS & BFS)
  • This is Visualization of Simple Solving A Maze by C.

  • To generate gif file, we need ImageMagick.

  • We can generate gif file following commands.

  • DFS

gcc main.c img.c -std=c99 -o main && ./main dfs;
@kira924age
kira924age / hex.c
Last active November 22, 2022 15:32
Hexdump and Reverse Hexdump by C and Python.
#include <stdio.h>
int main(int argc, char *argv[])
{
int n;
unsigned long long int count = 0;
FILE *fp;
if(argc != 2){
puts("Usage: hex [file_name]");
@kira924age
kira924age / main.go
Last active November 21, 2019 12:10
booklet2019b
package main
import (
"database/sql"
"encoding/json"
"fmt"
"log"
"net/http"
"github.com/go-chi/chi"
@kira924age
kira924age / reverse.c
Created January 18, 2018 12:49
Reverse string.
#include <stdio.h>
#include <string.h>
void swap(char *x, char *y) {
char tmp; tmp = *x;
*x = *y;
*y = tmp;
}
void *reverse(char *s) {
@kira924age
kira924age / dotr_solve.py
Last active December 31, 2017 12:17
34C3 Junior CTF: dotr
#!/usr/bin/env python2
# coding: utf-8
import itertools
def decrypt(msg, k):
m = "*" * len(msg)
c = 0
for i in k:
for j in range(i, len(msg), 8):
#include <iostream>
#include <string>
#include <stack>
#include <map>
#include <cstdlib>
#include <cctype>
using namespace std;
void str2arr(string s, string A[]) {
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <cstdlib>
#include <cctype>
#include <cstdio>
using namespace std;
@kira924age
kira924age / eratosthenes.rb
Created October 20, 2017 11:57
Sieve of Eratosthene
def era(n)
$primes = Array.new(n, true)
$primes[0], $primes[1] = false, false
(2..Math.sqrt(n)).each do |i|
if $primes[i]
(i * i).step(n, i).each do |j|
$primes[j] = false
end
end
end
@kira924age
kira924age / caesar.py
Created October 15, 2017 23:20
シーザー暗号(AOJ0017)
#!/usr/bin/env python2
# coding: utf-8
def caesar(s, n):
d = {}
for c in (65, 97):
for i in range(26):
d[chr(i+c)] = chr((i+n) % 26 + c)
return "".join([d.get(c, c) for c in s])
@kira924age
kira924age / pointer.c
Last active October 15, 2017 21:46
ポインタのお勉強
#include <stdio.h>
#include <string.h>
void *test(char *s) {
int i;
for (i = 0; i < strlen(s); i++) {
// ポインタが指す値を表示する3通りの方法
printf("%c\n", s[i]);
printf("%c\n", *(&s[0] + i));