Skip to content

Instantly share code, notes, and snippets.

View flymrc's full-sized avatar
🙈
On vacation

ruichao.ma flymrc

🙈
On vacation
View GitHub Profile
@photuris
photuris / xhtml2pdf.css
Created January 18, 2011 19:37
xhtml2pdf.css
@font-face {
font-family: Inconsolata;
src: url(/usr/local/share/Inconsolata.ttf);
}
@page {
size: letter;
margin: .75in;
}
@esperlu
esperlu / mysql2sqlite.sh
Created April 27, 2011 05:46
MySQL to Sqlite converter
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
@psdtohtml5
psdtohtml5 / snippet.js
Created August 12, 2013 21:39
JavaScript : Scroll and Focus to Element (input)
var cursorFocus = function(elem) {
var x = window.scrollX, y = window.scrollY;
window.scrollTo(x, y);
elem.focus();
}
cursorFocus(document.getelementbyId('search-terms'));
@justqyx
justqyx / pg_timezone_names.txt
Created April 24, 2014 08:05
select * from pg_timezone_names;
name | abbrev | utc_offset | is_dst
----------------------------------+--------+------------+--------
Africa/Abidjan | GMT | 00:00:00 | f
Africa/Accra | GMT | 00:00:00 | f
Africa/Addis_Ababa | EAT | 03:00:00 | f
Africa/Algiers | CET | 01:00:00 | f
Africa/Asmara | EAT | 03:00:00 | f
Africa/Asmera | EAT | 03:00:00 | f
Africa/Bamako | GMT | 00:00:00 | f
Africa/Bangui | WAT | 01:00:00 | f
git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
git config --global --unset http.proxy
git config --global --unset https.proxy
npm config delete proxy
@ianschenck
ianschenck / new_app.py
Last active July 30, 2023 03:00
Run your flask app under twisted wsgi, ALWAYS.
if __name__ == "__main__":
reactor_args = {}
def run_twisted_wsgi():
from twisted.internet import reactor
from twisted.web.server import Site
from twisted.web.wsgi import WSGIResource
resource = WSGIResource(reactor, reactor.getThreadPool(), app)
site = Site(resource)
@hmldd
hmldd / scroll.py
Last active October 6, 2023 14:59
Example of Elasticsearch scrolling using Python client
# coding:utf-8
from elasticsearch import Elasticsearch
import json
# Define config
host = "127.0.0.1"
port = 9200
timeout = 1000
index = "index"
@devinhyden
devinhyden / vuetifyjs-login.html
Last active March 26, 2021 08:14
Vuetifyjs Login Form
<!DOCTYPE html>
<html>
<head>
<link href='https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Material+Icons' rel="stylesheet">
<link href="https://unpkg.com/vuetify/dist/vuetify.min.css" rel="stylesheet">
</head>
<style>
#app {
@gpchelkin
gpchelkin / dante_setup.sh
Last active August 22, 2023 06:45
How to Setup SOCKS5 Proxy Server for (not only) Telegram using Dante on Ubuntu 16.04 / 18.04 / 20.04
### NOT A SCRIPT, JUST A REFERENCE!
# install dante-server
sudo apt update
sudo apt install dante-server
# or download latest dante-server deb for Ubuntu, works for 16.04 / 18.04 / 20.04:
wget http://archive.ubuntu.com/ubuntu/pool/universe/d/dante/dante-server_1.4.2+dfsg-7build5_amd64.deb
# or older version:
wget http://ppa.launchpad.net/dajhorn/dante/ubuntu/pool/main/d/dante/dante-server_1.4.1-1_amd64.deb
@daniel-j
daniel-j / hdmvpgs.js
Last active February 8, 2024 09:27
HDMV/PGS subtitle Javascript parser
'use strict'
function HDMVPGS (ctx) {
this.ctx = ctx || document.createElement('canvas').getContext('2d')
this.lastVisibleSegment = null
this.segments = []
this.loaded = false
}
HDMVPGS.prototype.loadBuffer = function (arraybuffer) {