Skip to content

Instantly share code, notes, and snippets.

View hvnsweeting's full-sized avatar

Viet Hung Nguyen hvnsweeting

View GitHub Profile
@hvnsweeting
hvnsweeting / fmltoc.md
Last active October 11, 2015 23:48
Technologies of choice - FAMILUG

Technologies of choice

OS

ubuntu

Editor

vim / sublime text 2

SVC

git

Language

#!/usr/bin/env python
# Cho 100 cai bong den
n = 101
bulb_states = [True for _ in range(n)]
bulb_states[0] = False
"""
Nguoi thu 1 bat het 100 cai len
Nguoi thu 2 tat cai so 2,4,6,8...
#!/usr/bin/env python
threshold = 101
primes = [True for _ in range(threshold)]
for number in range(len(primes)):
if number == 0 or number == 1:
primes[number] = False
continue
for denominator in range(number * 2, threshold, number):
MI4022 Xemina (IIb) 12/12/12 Kíp 2
MI4042 Lập trình mạng 14/12/12 Kíp 2
MI4140 Cơ sở dữ liệu nâng cao 21/12/12 Kíp 2
MI4150 Lý thuyết nhận dạng 05/12/12 Kíp 2
MI4210 Hệ hỗ trợ quyết định 19/12/12 Kíp 2
import requests
import json
import secutils as sec
HOST = "http://0.0.0.0:8080/create"
rules = [{"ip" : "123.123.123.123", "type":"all"},
{"ip" : "192.168.4.130" , "type" : "all"},
{"ip" : "192.168.3.182" , "type" : "all"},
{"ip" : "123.30.53.12" , "type" : "all"},
{"ip" : "222.255.27.156" , "type" : "all"},
import requests
import json
import secutils as sec
HOST = "http://0.0.0.0:8080/"
creat_url = "create"
token_url = "token"
delete_url = 'delete'
def get_token():
-- phpMyAdmin SQL Dump
-- version 3.1.3
-- http://www.phpmyadmin.net
--
-- Serveur: localhost
-- Généré le : Mer 04 Avril 2012 à 16:54
-- Version du serveur: 5.1.32
-- Version de PHP: 5.2.9-1
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
\documentclass[a4paper, 14pt, xcolor=dvipsnames]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[vietnam]{babel}
\usecolortheme[named=OliveGreen]{structure}
\useoutertheme{infolines}
\title{openVPN RESTFUL WebService}
\institute{FAMI2K53-HUST}
\author{Nhóm 10}
@hvnsweeting
hvnsweeting / fibs.py
Created November 25, 2012 04:48
many ways to print out first N fibonacci numbers
def fib(n):
if n < 2:
return n
else:
return fib(n-1) + fib(n-2)
def fib_fast(n):
from math import sqrt
s5 = sqrt(5)
#!/usr/bin/env python
#NOTE must run with sudo
import logging
import subprocess as spr
from pprint import pprint, pformat
from ConfigParser import SafeConfigParser
import confparser, ifaces
from util import get_abs_path, print_and_log_maker