Skip to content

Instantly share code, notes, and snippets.

@ThinkDone
ThinkDone / Vagrantfile
Created October 22, 2021 05:31 — forked from tvjames/Vagrantfile
Prepare a Windows Server 2008 R2 instance for use with vagrant-windows.
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
@ThinkDone
ThinkDone / 0_reuse_code.js
Created June 9, 2017 05:46
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
import requests, chardet, codecs, time
from bs4 import BeautifulSoup as bs
urls = [
"https://www.collectui.com/challenges/sign-up",
"https://www.collectui.com/challenges/checkout",
"https://www.collectui.com/challenges/landing-page",
"https://www.collectui.com/challenges/calculator",
"https://www.collectui.com/challenges/app-icon",
"https://www.collectui.com/challenges/user-profile",
@ThinkDone
ThinkDone / Bootstrap_Basic_Template.html
Created April 12, 2017 09:52
a minimal Bootstrap document
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Bootstrap 101 Template</title>
<!-- Bootstrap -->
@ThinkDone
ThinkDone / yield.py
Created November 30, 2016 06:34
yield returns a generator, as well as in contextmanager and pytest fixture, the next() is hidden invoked.
>>> def a():
yield {'a':1}
>>> a = a()
>>> a.items()
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
a.items()
AttributeError: 'generator' object has no attribute 'items'
class A():pass
class B():
def __enter__(self): # The with statement guarantees that if the __enter__() method returns without an error, then __exit__() will always be called.
return A()
def __exit__(self, exc_type, exc_value, traceback): # If the context was exited without an exception, all three arguments will be None.
return False # Reraise the exception
return True # Suppress the exception
def c():
@ThinkDone
ThinkDone / tmux-cheatsheet.markdown
Last active October 31, 2016 06:22 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@ThinkDone
ThinkDone / novel_python2.py
Last active June 9, 2017 05:34
download novel
# -*- coding: utf-8 -*-
import requests, chardet, codecs, time
from bs4 import BeautifulSoup as bs
from urlparse import urlparse, urljoin
BOOK_HOME = 'http://www.biqugex.com/book_869/'
BOOK_HOME = 'http://www.uctxt.com/book/23/23193/'
BOOK_HOME = 'http://www.shuge.net/html/99/99268/'
BOOK_HOME = 'http://www.xszww.com/html/54/54708/'