2020년 2월 8일 토요일

RecalBox 설치

1. RecalBox 다운로드

2. Etcher 다운로드(portable)

4. ResberryPi 구동(전원연결), wifi 설정

5. Mame roms  추가
  • RecalBox ip -> 192.168.0.100인 경우
  • 웹 브라우저 -> http://RecalBox ip 접속
  • Roms/Mame 메뉴에 롬 업로드



6. 조이스틱 설정
  • 가지고 있던 조이스틱이 아무리 해도 설정이 안되는 경우.
  • 가상 게임패드는 http://RecalBox ip:8080


그냥 저냥 할만하다. (조이스틱 사야지..)

2020년 2월 7일 금요일

c# invoke, backgroundworker, socket client sample(돌아가기만 하는 코드)

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace PiCalendar
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            this.bgw1.WorkerSupportsCancellation = true;
            this.bgw1.RunWorkerAsync();
        }

        private void Form1_FormClosed(object sender, FormClosedEventArgs e)
        {
            if (this.bgw1.IsBusy)
            {
                this.bgw1.CancelAsync();
            }
        }

        private void bgw1_DoWork(object sender, DoWorkEventArgs e)
        {
            // Data buffer for incoming data.
            byte[] bytes = new byte[1024];
            string data = null;
            // Connect to a remote device.
            try
            {
                // Establish the remote endpoint for the socket.
                // This example uses port 11000 on the local computer.
                IPHostEntry ipHostInfo = Dns.GetHostEntry(Dns.GetHostName());
                IPEndPoint remoteEP = new IPEndPoint(ipAddress, 62000);

                // Create a TCP/IP  socket.
                Socket client = new Socket(ipAddress.AddressFamily,
                    SocketType.Stream, ProtocolType.Tcp);

                // Connect the socket to the remote endpoint. Catch any errors.
                try
                {
                    client.Connect(remoteEP);

                    Console.WriteLine("Socket connected to {0}",
                        client.RemoteEndPoint.ToString());

                    // Encode the data string into a byte array.
                    byte[] msg = Encoding.ASCII.GetBytes("hello\r\n");

                    // Send the data through the socket.
                    int bytesSent = client.Send(msg);

                    int cnt = 0;
                    while (true)
                    {
                        if (this.bgw1.CancellationPending)
                        {
                            break;
                        }
                        bytes = new byte[4096];
                        int bytesRec = client.Receive(bytes);
                        data += Encoding.UTF8.GetString(bytes, 0, bytesRec);
                        if (data.IndexOf("\r\n") > -1)
                        {
                            if (data == "quit")
                            {
                                break;
                            }
                            cnt++;
                            if (this.InvokeRequired)
                            {
                                this.richTextBox1.Invoke(new Action(delegate ()
                                {
                                    if (cnt == 50)
                                    {
                                        this.richTextBox1.ResetText();
                                        cnt = 0;
                                    }
                                    this.richTextBox1.AppendText(data);
                                    this.richTextBox1.ScrollToCaret();

                                }));
                            }
                            data = string.Empty;
                        }
                    }

                    // Release the socket.
                    client.Shutdown(SocketShutdown.Both);
                    client.Close();

                }
                catch (ArgumentNullException ane)
                {
                    Console.WriteLine("ArgumentNullException : {0}", ane.ToString());
                }
                catch (SocketException se)
                {
                    Console.WriteLine("SocketException : {0}", se.ToString());
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Unexpected exception : {0}", ex.ToString());
                }

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }

        private void bgw1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            Console.WriteLine("bgw1 completed");
        }
    }
}

라즈베리 파이 pihole plex cups

1. 모니터 상하 변경 && wifi
 $ sudo vi /boot/config.txt

 lcd_rotate=2

 # wifi는 그냥 디폴트 사용 - 국가를 바꾸면 접속 안됨.

2.  vim && locale && fonts
 $ sudo apt-get update && sudo apt-get upgrade
 $ sudo apt-get install vim
 # locale 설정 sudo dpkg-reconfigure locales or gui화면에서 설정 폰트 설치
 $ sudo apt-get install fonts-unfonts-core

3. pihole 설치

 # 소스 설치
 $ sudo curl -sSL https://install.pi-hole.net | bash

 # pihole 관리자 페이지 password 변경
 $ sudo pihole -a -p

 # 포트 변경
 $ sudo vi /etc/lighttpd/lighttpd.conf
 # server.port = 80
 server.port = 9090

 여기서 확인하고 설정

 https://godpeople.or.kr/board/3411168

 daum 추가 했더니 동영상 재생이 안되어 삭제

 # windows 공유폴더
 https://webnautes.tistory.com/721

4. plex
 $ echo "deb https://downloads.plex.tv/repo/deb public main" | sudo tee  /etc/apt/sources.list.d/plexmediaserver.list

 $ curl https://downloads.plex.tv/plex-keys/PlexSign.key | sudo apt-key add -

 $ sudo apt-get update && sudo apt-get install plexmediaserver

 # http://respi-ip:32400/ 접속 - plex  가입한 후 로그인 필요.(전에는 안그랬던 거 같은데...)

5. cups - HP Color LaserJet Pro MFP M180n
 $ sudo apt-get install cups

 # 그룹, 권한
 $ sudo usermod -a -G lpadmin pi
 $ sudo cupsctl --remote-any

 # http://respi-ip:631/admin/ 접속

 # admin 접속이 안 될 경우
 $ sudo vi /etc/cups/cupsd.conf
 # Location Allow ip 추가

 # driver는 설치 안해도 됨.(유사한 거 선택) - HP Color LaserJet CM2320N MFP
 # scan test 필요 xsane or sane

2017년 1월 13일 금요일

oracle delete 데이터 복구(flashback query)

SQL> show parameter undo;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
undo_management                      string      AUTO
undo_retention                       integer     900
undo_tablespace                      string      UNDOTBS1
-- 현재 900초로 되어있음

SQL> alter system set undo_retention = 7200;

System altered.

SQL> show parameter undo;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
undo_management                      string      AUTO
undo_retention                       integer     7200
undo_tablespace                      string      UNDOTBS1


SELECT *
FROM TABLE_NAME
AS OF TIMESTAMP(SYSTIMESTAMP - INTERVAL '120' MINUTE)
WHERE FILED_NAME = ?;
으로 검색해서 삭제된 데이터를 찾을 수 있다. 복구는 알아서...

2016년 12월 23일 금요일

bash shell 색상


export LS_COLORS="di=01;33":"fi=01;37":"ex=01;32":"ln=01;36":"so=01;33"