Skip to content

Instantly share code, notes, and snippets.

View somma's full-sized avatar

somma somma

View GitHub Profile
@somma
somma / tiny_pe.asm
Created November 5, 2019 14:11
Very tiny program that prints the sum of 1 to 10.
;
; TinyPE.asm
;
BITS 32
; IMAGE_NT_HEADERS 의 시작 위치가 4 이어야 하므로 섹션/파일 얼라인먼트를 4 로.
; 공교롭게도 e_lfanew = 4 로 동일하게 맞아떨어짐
;
SectionAlignment equ 0x00000004
@somma
somma / stdafx.h
Created July 19, 2017 07:34
stdafx.h
/**
* @file AntiRanSomware user mode engine
* @brief
* @ref
* @author Yonhgwhan, Roh (fixbrain@gmail.com)
* @date 2017/01/21 created.
* @copyright All rights reserved by Yonghwan, Roh.
**/
#pragma once
# set prefix
set -g prefix `
unbind C-b
bind ` send-prefix
 
# split pane
bind | split-window -h
bind - split-window -v
 
# move to pane
@somma
somma / create_process_as_login_user.cpp
Last active August 27, 2022 15:32
create_process_as_login_user
bool
create_process_as_login_user(
_In_ const wchar_t* cmdline
)
{
_ASSERTE(NULL != cmdline);
if (NULL == cmdline) return false;
DWORD session_id = WTSGetActiveConsoleSessionId();
DWORD explorer_pid = 0xFFFFFFFF;
import json
from slacker import Slacker
from websocket import create_connection
slack = Slacker('xxxxxx')
# start RTM
rtm = slack.rtm.start()
url = rtm.body['url']
ws = create_connection(url)
+ create `/Users/somma/Library/KeyBindings/DefaultKeyBinding.dict` file with below contents, and reboot :D
{
/* Remap Home / End keys to be correct */
"\UF729" = "moveToBeginningOfLine:"; /* Home */
"\UF72B" = "moveToEndOfLine:"; /* End */
"$\UF729" = "moveToBeginningOfLineAndModifySelection:"; /* Shift + Home */
"$\UF72B" = "moveToEndOfLineAndModifySelection:"; /* Shift + End */
"^\UF729" = "moveToBeginningOfDocument:"; /* Ctrl + Home */
"^\UF72B" = "moveToEndOfDocument:"; /* Ctrl + End */
@somma
somma / multiprocessing with instance method
Last active March 25, 2022 19:54
Code illustrates how to pass instance method to multiprocessing and use functools.partial with pool.map() method.
#!/usr/bin/python
# -*- coding:utf-8 -*-
"""
Idea and code was taken from stackoverflow().
This sample illustrates how to
+ how to pass method of instance method
to multiprocessing(idea and code was introduced
at http://goo.gl/tRHN1D by torek).
@somma
somma / async_request_handler
Last active August 29, 2015 14:16
This is sample code about how to handle synchronous function as asynchronously in `tornado.web.RequestHandler` using `@tornado.gen.coroutine`.
#!/usr/bin/python
# -*- coding:utf-8 -*-
"""
This is sample code about how to handle synchronous function
as asynchronously in `tornado.web.RequestHandler` using `@tornado.gen.coroutine`.
Feel free to suggest idea or nicer python style code.
I'm a newbie to python :-)
by somma (fixbrain@gmail.com)
/**
* @brief 포인터 타입에 상관없이 free() and Nil 을 수행하는 템플릿 함수
void my_free(void*& ptr)
{
...
}
char* char_ptr;
void* void_ptr;
"schtasks.exe /create /tn {task_name} /tr {task_bin_path} /sc onlogon /rl highest /f