Skip to content

Instantly share code, notes, and snippets.

View tlkahn's full-sized avatar

Wingk tlkahn

View GitHub Profile
#!/usr/bin/env python
# parse_toc.py
from pdfminer.pdfparser import PDFParser
from pdfminer.pdfdocument import PDFDocument
def parse(filename, maxlevel):
fp = open(filename, 'rb')
parser = PDFParser(fp)
doc = PDFDocument(parser)
' this code extracts text from PPT(X) and saves to latex beamer body
Public Sub Extract2Beamer()
Dim objPresentation As Presentation
Set objPresentation = Application.ActivePresentation
Dim objSlide As Slide
Dim objshape As Shape
Dim objShape4Note As Shape
Dim hght As Long, wdth As Long
' this code extracts text from PPT(X) and saves to latex beamer body
' Provided for free with no guarantees or promises
'WARNING: this will overwrite files in the powerpoint file's folder if there are name collisiona
' Original version by Louis from StackExchange (https://tex.stackexchange.com/users/6321/louis) available here: (https://tex.stackexchange.com/questions/66007/any-way-of-converting-ppt-or-odf-to-beamer-or-org)
' Modified by Jason Kerwin (www.jasonkerwin.com) on 20 February 2018:
' Takes out extra text that printed in the title line
' Switches titles to \frametitle{} instead of including them on the \begin{frame} line (sometimes helps with compiling)
' Changes the image names to remove original filename, which might have spaces
' Removes "\subsection{}" which was printing before each slide
'NB you must convert your slides to .ppt format before running this code

Back propagation algorithm

(add-to-list 'load-path "~/.emacs.d/site-lisp/go-mode.el/")
(add-to-list 'load-path "~/.emacs.d/site-lisp/ox-ipynb/")
(autoload 'go-mode "go-mode" nil t)
(add-to-list 'auto-mode-alist '("\\.go\\'" . go-mode))
(let ((default-directory "/usr/local/share/emacs/site-lisp"))
(normal-top-level-add-subdirs-to-load-path))
(setq tramp-default-method "ssh")
(global-hl-line-mode 1)
const axios = require('axios');
const token = 'some token'
let toDelRepos = [
{ full_name: 'tlkahn/c_hashmap', owner: 335719, repo: 96976570 },
{ full_name: 'tlkahn/dashing', owner: 335719, repo: 61136695 },
{ full_name: 'tlkahn/es6-project-starter-kit',
owner: 335719,
repo: 93257409 },
{ full_name: 'tlkahn/fourmin', owner: 335719, repo: 93795559 },
#include <iostream>
#include <string>
using namespace std;
enum gender : bool {
male = true,
female = false
};
Portrait rights license agreement
 
 
Party A: (model or subject)
Party B: (Shanghai Jingshi Culture Communication Co., Ltd.)
 
Both parties have reached an agreement on the use of images with portraits of Party A as follows:
 
1. Party A agrees to take portrait photos by Party B (Shanghai Jingshi Culture Communication Co., Ltd.) and agrees that the photographs taken can be used in the Hopecolor brand's Tmall e-commerce webpage/apps as well as Hopecolor's other promotions. Party B's promotion and packaging including but not limited to brochures, leaflets, posters, and new media legal commercial use such as Douyin (Tiktok), Weibo, etc. This authorization to use is limtid to a one-year period. During the above said period, Party A shall not shoot portraits with other similar brands like Hopecolor .
2. After entering into this agreement, Party A shall not submit any other claims or litigations to Party B and the other third-party brand agents of Hopecolor, with regard to matters on portrait rights, privacy right
from Crypto.PublicKey import RSA
from Crypto import Random
from Crypto.Signature import PKCS1_v1_5
random_generator = Random.new().read
key = RSA.generate(1024, random_generator) # private key
public_key = key.publickey()
enc_data = public_key.encrypt('abcdefgh', 32)
key.decrypt(enc_data) # 'abcdefgh'
@tlkahn
tlkahn / test.py
Created October 26, 2017 05:44
min waiting time problem
import heapq
class MyHeap(object):
def __init__(self, initial=None, key=lambda x:x):
self.key = key
if initial:
self._data = [(key(item), item) for item in initial]
heapq.heapify(self._data)
else:
self._data = []