Skip to content

Instantly share code, notes, and snippets.

View kkimdev's full-sized avatar

Kibeom Kim kkimdev

View GitHub Profile
View test.asm
test(long): # @test(long)
vpbroadcastq ymm0, rdi
vpcmpeqq k0, ymm0, ymmword ptr [rip + ls]
kmovw eax, k0
vpcmpeqq k0, ymm0, ymmword ptr [rip + ls+32]
kmovw ecx, k0
shl rcx, 4
vpcmpeqq k0, ymm0, ymmword ptr [rip + ls+64]
or rcx, rax
kmovw eax, k0
View docker_host_port_forward.bash
#!/usr/bin/env bash
set -Eeuxo pipefail
# Usage example: ./docker_host_port_forward.bash start 4000 14000
# ./docker_host_port_forward.bash stop 4000 14000
# TODO: alpine/socat is not necessarily trustworthy. Find a better base image
# or build ourselves.
# TODO: If socat is not installed, it fails silently. We should let user know
# if it failed and why it failed.
View KeyValueFile.py
import sqlite3
class KeyValueFile:
def __init__(self, path):
self.conn = sqlite3.connect(path)
self.c = self.conn.cursor()
self.c.execute('CREATE TABLE IF NOT EXISTS keyvalue (key text PRIMARY KEY, value text)')
def put(self, key, value):
self.c.execute("INSERT OR REPLACE INTO keyvalue VALUES (?,?)", (key, value))