Skip to content

Instantly share code, notes, and snippets.

View toast254's full-sized avatar
🐧

toast254 toast254

🐧
View GitHub Profile
import java.util.*;
public class Fibonacci
{
private HashMap <Integer,Double> fibo_results;
private int number;
private boolean fast_mode;
private boolean cache_mode;
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
import sys
import requests # http://docs.python-requests.org/en/master/
from bs4 import BeautifulSoup # http://www.crummy.com/software/BeautifulSoup/
# OpenNIC url
url = 'https://servers.opennicproject.org'
# -*- coding: utf-8 -*-
"""Generic linux daemon base class for python 3.x."""
import os
import sys
import time
import atexit
import signal
import logging
#
# smartcard_list.txt
# Copyright (C) 2002-2018 Ludovic Rousseau
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
from tornado import httpserver, ioloop, netutil, process, web, options
# app's title
__title__ = 'Example'
options.define('port', default=8080, help='run on the given port', type=int)
# -*- coding: UTF-8 -*-
import os
import csv
import logging
logger = logging.getLogger(__name__)
def read_csv(file: str = 'in.csv', skip_title: bool = True):
@toast254
toast254 / dict_merge.py
Last active May 16, 2017 13:39 — forked from angstwad/dict_merge.py
Recursive dictionary merge in Python 3
# -*- coding: utf-8 -*-
import collections
def dict_merge(dct: dict, merge_dct: dict):
""" Recursive dict merge. Inspired by :meth:``dict.update()``, instead of
updating only top-level keys, dict_merge recurses down into dicts nested
to an arbitrary depth, updating keys. The ``merge_dct`` is merged into
``dct``.
# -*- coding: utf-8 -*-
import time
import threading
class ThreadedClass(object):
""" Threading example class.
The run() method will be started and it will run in the background
# -*- coding: utf-8 -*-
import os
import json
import logging
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
logger = logging.getLogger(__name__)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import csv
import psycopg2
# Connection details:
dbname = 'sampledb'
user = 'postgres'