Skip to content

Instantly share code, notes, and snippets.

View kuanyui's full-sized avatar
❄️
なんでそんなに慣れてんだよ!

クエン酸 kuanyui

❄️
なんでそんなに慣れてんだよ!
View GitHub Profile
@jhjguxin
jhjguxin / gpg-tour.md
Created July 19, 2013 08:18
GPG 加密解密简明教程 </br> 作者: riku / 本文采用CC BY-NC-SA 2.5协议 授权

GPG 加密解密简明教程

大家都知道,互联网上充斥着大量的明文传输方式,可以说绝对是不安全地带。那么,我们如何保证在不安全的互联网中更可靠的传输重要数据呢?个人认为最好的方式之一就是使用 GPG 工具进行加密。此文只是简单介绍了 GPG 的常规用法,重在推广和普及 GPG 加密工具,详细的使用请参见 GPG 手册。

名词解释

RSA / DSA / ElGamal : 是指加密算法

GPG :(全称 GnuPG ) 是一款非对称加密(PGP)的免费软件,非对称加密方式简单讲就是指用公钥加密文件,用私钥解密文件。如果你想给谁发送加密信息,首先你要得到他的公钥,然后通过该公钥加密后传给他,对方利用自已的私钥就可解密并读取文件了。

@letoh
letoh / gist:6281840
Created August 20, 2013 13:59
parsing test
(with-current-buffer "abc"
(with-output-to-temp-buffer "*result*"
(goto-char (point-min))
(let* ((template (concat "<!-- 一篇推文開始 -->
<section>
<a class=\"username\" href=\"https://twitter.com/%s\">%s</a>
<a class=\"date\" href=\"%s\">%s</a>
<div class=\"tweetcontent\">%s</div>
</section>
@alanhamlett
alanhamlett / ajax_setup.js
Last active January 13, 2021 02:18
Sets the X-CSRFToken header for every jQuery ajax non-GET request to make CSRF protection easy. This fixes the example from Django docs here: https://docs.djangoproject.com/en/dev/ref/contrib/csrf/#ajax
$.ajaxSetup({
beforeSend: function(xhr, settings) {
if (settings.type == 'POST' || settings.type == 'PUT' || settings.type == 'DELETE') {
function getCookie(name) {
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
@doloopwhile
doloopwhile / qqimageviewer.py
Created September 29, 2013 13:21
Damn ImageViewer by PyQt5 and QtQuick.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from os.path import (
join,
dirname,
)
from PyQt5.QtCore import QUrl
@coldnew
coldnew / english chinese font setting
Last active November 11, 2020 13:23
org-mode template for my chinese and english font setting
* 字體設置 :font:
** 英文字體與中文字體設置
- 英文字體
#+begin_src emacs-lisp
(defvar emacs-english-font "Monaco"
"The font name of English.")
#+end_src
@abn
abn / python-flask-task-async.py
Last active September 19, 2024 12:38
A module to facilitate dispatch of asynchronous tasks in a Flask App. This was designed to work standalone in an embedded fashion without dependencies like flask-celery, redis etc. This is not meant to be a reliable means to execute tasks, just a quick and easy solution for most needs.
"""
An asynchronous task manager.
This is a simple implementation for background task handing. No guarentees are
provided for task execution.
This was developed in the course of the work don for the victims project and
that version is available at
https://github.com/victims/victims-web/blob/master/src/victims_web/handlers/task.py
@XVilka
XVilka / TrueColour.md
Last active October 9, 2025 17:55
True Colour (16 million colours) support in various terminal applications and terminals

THIS GIST WAS MOVED TO TERMSTANDARD/COLORS REPOSITORY.

PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!

@furaibo
furaibo / e-hentai.py
Last active July 29, 2025 14:19
E-Hentaiギャラリーの画像をダウンロードするPythonスクリプトです。ご自由にお使い下さい。
#!/usr/bin/python
#-*-coding:utf-8 -*-
# E-HentaiのページURLをもとにギャラリー画像を取得するスクリプト
# パッケージのインポート
import os
import sys
import re
import urllib2
@ethan5422
ethan5422 / eshell-insert-last-word.el
Last active January 4, 2016 08:09
eshell-insert-last-word
(defun eshell-last-argument (n m)
(let* ((input (substring-no-properties
(eshell-previous-input-string (1- m))))
(parse (with-temp-buffer
(insert input)
(nth (1- n) (reverse (eshell-parse-arguments
(point-min) (point-max)))))))
(eval parse)))
(defun eshell-insert-last-word (n)
@lzh9102
lzh9102 / cpu.py
Created March 29, 2014 13:53
Show cpu usage on Linux
#!/usr/bin/env python
import time
import sys
def getCpuTime():
totaltime = 0
idletime = 0
with open("/proc/stat", "r") as f:
for line in f: