Skip to content

Instantly share code, notes, and snippets.

View itsjef's full-sized avatar

Anh Tran (Adrian) itsjef

View GitHub Profile
@itsjef
itsjef / [Guide] How to migrate Linux between two machines.md
Last active August 29, 2015 14:20
Short guide on how to move your Linux distro from a computer to another

##Step 1 - Backup your /home folder

  1. Install Backups tool by typing in the Terminal: sudo apt-get install deja-dup
  2. Backup your /home folder. Default backup is stored in ~/deja-dup folder

##Step 2 - Backup your package list

  1. Backup package list: sudo dpkg --get-selections > PackageList.txt
  2. Backup APT-key: sudo apt-key exportall > RepoKeys.txt
  3. Backup Source folder: sudo cp /etc/apt/sources.list.d source.list.d
  4. Copy all those files to an USB
@itsjef
itsjef / regex.md
Last active October 13, 2017 04:42
some RegEx patterns of mine ...

Số dtdd VN

  • Chi tiết: r'^(\+84|0)(8[689]|9\d|(1(2\d|6[2-9]|8[68]|99)))\d{7}$'
  • Thô thiển: r'^(\+84|0)\d{9,10}$'
@itsjef
itsjef / test.c
Created July 17, 2013 09:13
Game về từ ngữ các kiểu ....
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define MAX 1000
typedef struct dictionary{
char word[20];
char def[50];
float point;
@itsjef
itsjef / array.py
Last active December 14, 2015 17:49
tạo ra 1 cái bảng click click
import pygame
#colors
black = (0 ,0 ,0 )
white = (255,255,255)
blue = (0 ,0 ,255)
green = (0 ,255,0 )
red = (255,0 ,0 )
#width&height
@itsjef
itsjef / pygame_test.py
Created January 4, 2013 23:14
Yay! I just created the most boring game in the world -.-
#!/usr/bin/env python2.7
import pygame
import sys
pygame.init()
DISPLAYSURF = pygame.display.set_mode((400,300))
pygame.display.set_caption("Hello World")
while True:
for i in pygame.event.get():
@itsjef
itsjef / battleship.py
Last active December 10, 2015 15:19
bắn tàu đê \:D/
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
from random import randint
board = []
turn = 0
#tạo sân chơi
for x in range(0,5):
@itsjef
itsjef / giai_thua.py
Last active December 10, 2015 14:08
Hàm tính tích của n số tự nhiên dương đầu tiên (n!)
#!/usr/bin/env python2.7
def factorial(n):
ans = 1
if n == 0 or n == 1:
ans = 1
elif n < 0:
ans = 'no answer'
else:
for i in range(2, n+1):