Skip to content

Instantly share code, notes, and snippets.

@senko
senko / create-new-lxc.sh
Created March 1, 2013 13:00
Set up a new LXC virtual machine
#!/bin/bash
#
# Initialize new virtual server using LXC and set up networking and HTTP proxy
#
# Written by: Deni Bertovic <deni.bertovic@dobarkod.hr>
#
# Released into Public Domain. You may use, modify and distribute it as you
# see fit.
#
# This script will:
@sng2c
sng2c / using_PAR.mkd
Last active December 16, 2015 17:09
원격으로 PAR을 실행하는 세가지 방법

원격으로 PAR을 실행하는 세가지 방법

# Test1.pm
package Test1;
hello{
    print "HELLO\n";
}

1. PAR Repository 이용.

@sng2c
sng2c / detect_repetition.md
Last active March 6, 2022 10:33
detect_repetition.md

리스트에 기호들이 들어 있을 때, 연속된 기호가 일정한 거리를 두고 다시 나타나는 것을 반복이라고 하기로 하구요. 그 연속되는 기호의 단위 묶음을 반복셋이라고 하겠습니다. 같은 위치에서 시작하는 반복셋은 여러개가 있을 수 있습니다.

A B C A B C 의 경우에는

A _ _ A _ _  : offset 2
A B _ A B _  : offset 1

A B C A B C : offset 0

@sng2c
sng2c / KorMailSend.pm
Created September 6, 2013 02:04
한글로 메일 보내기
package KorMailSend;
use strict;
use warnings;
use MIME::Lite;
use MIME::Base64;
use Encode qw(encode);
sub sendmail{
my ($from,$to,$subj,$cont) = @_;
my $subj2 = '=?UTF8?B?' . encode_base64($subj) .'?=';
#!/bin/bash
#
# Initialize new virtual server using LXC and set up networking and HTTP proxy
#
# Written by: Deni Bertovic <deni.bertovic@dobarkod.hr>
#
# Released into Public Domain. You may use, modify and distribute it as you
# see fit.
#
# This script will:
@sng2c
sng2c / regpat.pl
Last active December 27, 2015 01:29
컴파일된 정규표현식의 원래 입력패턴을 알아내는 법
#!/usr/bin/env perl
use re 'regexp_pattern';
my $reg = qr/(?i)abc/s;
my ($pat,$flag) = regexp_pattern $reg;
print "pat :$pat\n"
print "flag:$flag\n";
# pat :(?i)abc
# flag:is
@sng2c
sng2c / proxy.pl
Last active December 27, 2015 15:28
perl proxy server
#!/usr/bin/env perl
use HTTP::Proxy;
my $proxy = HTTP::Proxy->new(
host => '',
port => 8080,
maxchild=>10,
);
$proxy->start;
import scala.swing._
import scala.swing.event._
object ButtonApp extends SimpleSwingApplication {
def top = new MainFrame {
title = "My Frame"
contents = new GridPanel(2, 2) {
hGap = 3
vGap = 3
contents += new Button {
@sng2c
sng2c / gen_thumb.pl
Last active December 28, 2015 04:49
#!/usr/bin/env perl
use 5.010;
my $path = '.';
my @types=qw( mov mp4 avi mkv m4v xvid divx wmv mpg mpeg );
my @files = `find $path`;
chomp(@files);
@twkang
twkang / read_cert.py
Last active January 18, 2021 03:58
파이썬으로 공인인증서 파일 읽기 (추가 설치 모듈: cryptography, pyasn1)
import os
import getpass
from pyasn1.codec.der import decoder as der_decoder
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import padding, hashes
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from cryptography.hazmat.primitives.asymmetric import padding as asympad
from cryptography.hazmat.primitives.serialization import load_der_private_key