Skip to content

Instantly share code, notes, and snippets.

View dbwodlf3's full-sized avatar
🐢
I may be slow to respond.

Cogi dbwodlf3

🐢
I may be slow to respond.
  • SWLAB
  • Republic of Korea
View GitHub Profile
@dbwodlf3
dbwodlf3 / anvil.py
Created December 1, 2020 12:24
anvil memo
import sys
sys.path.append("/path/to/anvill/python")
import anvill
p = anvill.get_program(cache=False)
p.add_function_definition(here())
open("/tmp/spec.json", "w").write(p.proto())
@dbwodlf3
dbwodlf3 / test.py
Created December 1, 2020 08:48
multi processing synchronization in python
from multiprocessing import Process
def bigJob():
#
result = 0
#
for i in range(12345678):
result += i
print(result)
@dbwodlf3
dbwodlf3 / python2_struct_example.py
Last active November 25, 2020 07:02
Python 2 use struct instead of int.from_bytes
"""
docs: https://docs.python.org/2/library/struct.html#struct-format-strings.
This example is just for using struct library instead of int.from_bytes.
"""
import struct
bs1 = b'\xff\xff'
bs2 = struct.unpack('<L', bs1)[0]
@dbwodlf3
dbwodlf3 / homework.py
Last active September 29, 2020 09:46
Pytorch Example. Batch Normalization
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import numpy as np
# I think my nural network learn x1^3 + x2^2 + x1^1 + 1...
# x 는 -1~1 까지.
@dbwodlf3
dbwodlf3 / main.py
Last active September 17, 2020 18:16
Random forest Example
#!/usr/bin/python3
"""Random Forest Examples. 2020-09-17. Author: Yu JaeIL
This example follows https://towardsdatascience.com/random-forest-in-python-24d0893d51c0
These codes are written and test in python 3.7.7.
References,
decision tree: https://www.youtube.com/watch?v=n0p0120Gxqk&t=5s
randorm forest: https://www.youtube.com/watch?v=nZB37IBCiSA
One-Hot-Encode: https://en.wikipedia.org/wiki/One-hot
@dbwodlf3
dbwodlf3 / _result.txt
Last active September 11, 2020 05:51
anderson algorithm
=======
Answer
=======
[[p]] : {z, y, alloc_1}
[[alloc_1]] : set()
[[q]] : {y}
[[z]] : set()
[[x]] : set()
[[y]] : set()
====
@dbwodlf3
dbwodlf3 / markdown.md
Last active August 14, 2020 11:02
test markdown
$ humm
# hum
hm3
// comment
; comment
/* comment */
@dbwodlf3
dbwodlf3 / id.js
Last active August 11, 2020 13:34
JavaScript Code creating ID from time stamp with sha256
async function makeId(number){
let bitMask1 = 0xffffffffffffffffffffffffffffffff00000000000000000000000000000000;
let bitMask2 = 0x00000000000000000000000000000000ffffffffffffffffffffffffffffffff;
let bitArray = new Uint32Array(2);
bitArray[0] = bitMask1^number;
bitArray[1] = bitMask2^number;
let hashBuffer = await crypto.subtle.digest('sha-256',bitArray);
let hashArray = Array.from(new Uint8Array(hashBuffer));
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <sys/mman.h>
void foo(void);
int change_page_permissions_of_address(void *addr);
int main(void)
@dbwodlf3
dbwodlf3 / HelloWorld.c
Last active July 20, 2020 08:55
McSema Simple Example 00.
#include <stdio.h>
int main(){
printf("Hello World.");
return 0;
}