Skip to content

Instantly share code, notes, and snippets.

@brettscott
brettscott / aes-256-cbc-test.js
Last active August 23, 2024 15:31
AES 256 CBC encryption between Golang and Node JS
// Node v6.9.0
//
// TEST FILE (cut down for simplicity)
// To ensure Golang encrypted string can be decrypted in NodeJS.
//
let crypto;
try {
crypto = require('crypto');
@direct-fuel-injection
direct-fuel-injection / redis.py
Created October 26, 2015 08:19
Cherrypy Redis Sessions on cherrys lib.
# -*- coding: utf-8 -*-
import cherrypy
import datetime
from cherrys import RedisSession
try:
import simplejson as json
except ImportError:
import json
@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
@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);
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 / 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;
@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
#!/bin/bash
#
# Initialize new virtual server using LXC and set up networking and HTTP proxy
#
# Written by: Deni Bertovic <[email protected]>
#
# Released into Public Domain. You may use, modify and distribute it as you
# see fit.
#
# This script will:
@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) .'?=';
@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