Skip to content

Instantly share code, notes, and snippets.

@wwwjfy
wwwjfy / cte.py
Created January 27, 2019 16:14
GINO equivalence of SQLAlchemy CTE
import asyncio
from gino import Gino
from sqlalchemy import Column
db = Gino()
class Node(db.Model):
__tablename__ = 'node'
id = Column(db.Integer, primary_key=True)
@wwwjfy
wwwjfy / Evernote2Notes.scpt
Created October 7, 2015 08:24
Convert Evernote notes to Notes notes
tell application "Evernote"
set foundNotes to find notes
repeat with aNote in foundNotes
set enTitle to (the title of aNote)
set aHTML to HTML content of aNote
if exists (source URL of aNote) then
set aHTML to "<p>source url: " & source URL of aNote & "</p>" & aHTML
end if
set folderName to (name of notebook of aNote)
@wwwjfy
wwwjfy / gist:1a3fa3d9599ef36a16d0
Created October 1, 2014 15:23
hide google translation bar in YouKu
Nova.Cookie.set("googtrans_flag", 0)
Nova.Cookie.set("googtrans", 0)
@wwwjfy
wwwjfy / gist:a79e262c6187dc281863
Created July 23, 2014 16:27
Save Safari and Google Chrome tabs in a single webpage
set docText to "<html><body>"
tell application "Safari"
--Variables
set windowCount to number of windows
--Repeat for Every Window
repeat with x from 1 to windowCount - 1
set tabcount to number of tabs in window x
@wwwjfy
wwwjfy / kindle_special.go
Created February 24, 2014 15:55
cron script to get daily deal of Kindle Store in Amazon China
package main
import (
"fmt"
"log"
"os"
"github.com/PuerkitoBio/goquery"
)
func main() {
@wwwjfy
wwwjfy / setdns
Created July 28, 2013 15:20
Set dns to 127.0.0.1 after Astrill connected
#!/bin/bash
adapter=$(echo "show Setup:/Network/Astrill" | scutil | sed -n '/Adapter/ s/^.*Adapter : \(.*\)/\1/ p')
sudo scutil <<EOF
open
d.init
d.add ServerAddresses * 127.0.0.1
set Setup:/Network/Service/$adapter/DNS
EOF