Skip to content

Instantly share code, notes, and snippets.

View byung-u's full-sized avatar
πŸ€

Byungwoo Jeon byung-u

πŸ€
  • Seoul, Republic of Korea
View GitHub Profile
/**
* Solves the n-Queen puzzle in O(n!)
* Let p[r] be the column of the queen on the rth row (must be exactly 1 queen per row)
* There also must be exactly 1 queen per column and hence p must be a permuation of (0 until n)
* There must be n distinct (col + diag) and n distinct (col - diag) for each queen (else bishop attacks)
* @return returns a Iterator of solutions
* Each solution is an array p of length n such that p[i] is the column of the queen on the ith row
*/
def nQueens(n: Int): Iterator[Seq[Int]] =
(0 until n)
@midwire
midwire / ffmpeg-install.sh
Last active September 4, 2018 08:00 — forked from clayton/ffmpeg-install.sh
Install FFMPEG on OS X with HomeBrew and all libs and support
brew install ffmpeg \
--with-dcadec \
--with-faac \
--with-fdk-aac \
--with-ffplay \
--with-fontconfig \
--with-freetype \
--with-frei0r \
--with-libass \
--with-libbluray \
@tintinweb
tintinweb / scapy_tcp_handshake.py
Last active May 9, 2025 08:24
simple scapy tcp three-way handshake
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Author : tintinweb@oststrom.com <github.com/tintinweb>
'''
A simple TCP three-way handshake example
#> python scapy_tcp_handshake.py
DEBUG:__main__:init: ('oststrom.com', 80)
DEBUG:__main__:start
DEBUG:__main__:SND: SYN
@fevangelou
fevangelou / my.cnf
Last active June 25, 2026 11:20
Optimized my.cnf configuration for MySQL/MariaDB (on Ubuntu, CentOS, Almalinux etc. servers)
# === Optimized my.cnf configuration for MySQL/MariaDB (on Ubuntu, CentOS, Almalinux etc. servers) ===
#
# by Fotis Evangelou, developer of Engintron (engintron.com)
#
# ~ Updated September 2024 ~
#
#
# The settings provided below are a starting point for a 8-16 GB RAM server with 4-8 CPU cores.
# If you have different resources available you should adjust accordingly to save CPU, RAM & disk I/O usage.
#
@squarism
squarism / iterm2.md
Last active July 14, 2026 10:11
An iTerm2 Cheatsheet

In the below keyboard shortcuts, I use the capital letters for reading clarity but this does not imply shift, if shift is needed, I will say shift. So ⌘ + D does not mean hold shift. ⌘ + Shift + D does of course.

Tabs and Windows

Function Shortcut
New Tab ⌘ + T
Close Tab or Window ⌘ + W (same as many mac apps)
Go to Tab ⌘ + Number Key (ie: ⌘2 is 2nd tab)
Go to Split Pane by Direction ⌘ + Option + Arrow Key
@jaceklaskowski
jaceklaskowski / deployment-tool-ansible-puppet-chef-salt.md
Last active June 14, 2026 04:52
Choosing a deployment tool - ansible vs puppet vs chef vs salt

Requirements

  • no upfront installation/agents on remote/slave machines - ssh should be enough
  • application components should use third-party software, e.g. HDFS, Spark's cluster, deployed separately
  • configuration templating
  • environment requires/asserts, i.e. we need a JVM in a given version before doing deployment
  • deployment process run from Jenkins

Solution

@protrolium
protrolium / ffmpeg.md
Last active May 25, 2026 14:10
ffmpeg guide

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

You can get the list of installed codecs with:

@junegunn
junegunn / gist:f4fca918e937e6bf5bad
Last active July 18, 2026 14:38
Browsing git commit history with fzf
# fshow - git commit browser (enter for show, ctrl-d for diff, ` toggles sort)
fshow() {
local out shas sha q k
while out=$(
git log --graph --color=always \
--format="%C(auto)%h%d %s %C(black)%C(bold)%cr" "$@" |
fzf --ansi --multi --no-sort --reverse --query="$q" \
--print-query --expect=ctrl-d --toggle-sort=\`); do
q=$(head -1 <<< "$out")
k=$(head -2 <<< "$out" | tail -1)
@ashrithr
ashrithr / kerberos_setup.md
Last active April 7, 2025 10:13
Set up kerberos on Redhat/CentOS 7

Installing Kerberos on Redhat 7

This installation is going to require 2 servers one acts as kerberos KDC server and the other machine is going to be client. Lets assume the FQDN's are (here cw.com is the domain name, make a note of the domain name here):

  • Kerberos KDC Server: kdc.cw.com
  • Kerberos Client: kclient.cw.com

Important: Make sure that both systems have their hostnames properly set and both systems have the hostnames and IP addresses of both systems in

@shoveller
shoveller / gist:b4d2e1e6d33906f2a667
Created July 3, 2014 14:06
μ™œ 파이썬 λ°μ½”λ ˆμ΄ν„°λ₯Ό λ§Œλ“€λ•Œ, @wrapsμ–΄λ…Έν…Œμ΄μ…˜μ„ μ“°λŠ” 것을 ꢌμž₯ν•˜λŠ” 걸까?
__author__ = 'artemr'
'''
μ™œ 파이썬 λ°μ½”λ ˆμ΄ν„°λ₯Ό λ§Œλ“€λ•Œ, @wrapsμ–΄λ…Έν…Œμ΄μ…˜μ„ μ“°λŠ” 것을 ꢌμž₯ν•˜λŠ” 걸까?
이유인 μ¦‰μŠ¨, λ°μ½”λ ˆμ΄ν„° λ‚΄λΆ€μ—μ„œ 인자둜 전달받은 ν•¨μˆ˜κ°€ 읡λͺ…ν•¨μˆ˜ 처럼 μ·¨κΈ‰λ˜μ–΄ λ²„λ¦¬λ―€λ‘œ 디버깅이 λ‚œν•΄ν•΄μ§€λŠ” 단점이 μžˆμ—ˆκΈ° λ•Œλ¬Έμ΄λ‹€.
μžμ„Έν•œ μ„€λͺ…은 μ•„λž˜μ˜ 링크에 μ²¨λΆ€λ˜μ–΄ μžˆλ‹€.
원본: http://artemrudenko.wordpress.com/2013/04/15/python-why-you-need-to-use-wraps-with-decorators/
사본: https://www.evernote.com/shard/s174/sh/78eaad5f-a8f2-4496-b984-e3385fb963c0/922d9ab4b5cd23ac7b85aab42536aa4f
'''