Skip to content

Instantly share code, notes, and snippets.

View maz-1's full-sized avatar
🐢
slow to respond

maz-1 maz-1

🐢
slow to respond
  • WolkenVision AG
  • China
View GitHub Profile
@jmazzi
jmazzi / lastpass_to_keepassx.rb
Created June 13, 2010 19:57
Convert LastPass CSV to KeePassX XML
#!/usr/bin/ruby
#
# I recommend using Pocket to do the export. It works better than the browser extensions.
require 'rubygems'
require 'htmlentities'
require 'csv'
# CHANGE THIS
input_file = '/path/to/passwords.csv'
@diogok
diogok / proxy.lua
Created April 15, 2011 17:09
Simple HTTP reverse proxy in Lua
#!/usr/bin/env lua
require 'socket'
require 'copas'
assert(arg[1],"Must pass host and port to listen")
assert(arg[2],"Must pass host and port to proxy")
local config = {
newhost=string.gsub(arg[1],"([^:]+):(%d+)","%1"),
newport=string.gsub(arg[1],"([^:]+):(%d+)","%2"),
@eric-hu
eric-hu / Open iterm tab here
Last active March 11, 2022 02:45
Apple script to open an iterm2 tab from right-clicking on a file or folder in Finder. To use: (1) Open Automator (2) Create a new service (3) Change "Service receives selected" drop downs to "Files or folders" in "Finder" (4) Select "Run applescript" from the sidebar, then paste this script in and save
-- Adapted from these sources:
-- http://peterdowns.com/posts/open-iterm-finder-service.html
-- https://gist.github.com/cowboy/905546
--
-- Modified to work with files as well, cd-ing to their container folder
on run {input, parameters}
tell application "Finder"
set my_file to first item of input
set filetype to (kind of (info for my_file))
-- Treats OS X applications as files. To treat them as folders, integrate this SO answer:
@jdewit
jdewit / unuconvd_template
Last active March 21, 2021 03:38
unoconv daemon
### BEGIN INIT INFO
# Provides: unoconvd
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: unoconvd Converting documents to PDF by unoconv
### END INIT INFO
#!/bin/sh
case "$1" in
@acgotaku
acgotaku / baidupan
Last active April 26, 2023 04:00
新版百度云盘aria2c导出下载 ,目前只实现了核心功能.
// ==UserScript==
// @name 百度网盘aria2导出工具
// @author acgotaku311
// @description 一个方便吧百度网盘的Aria2rpc导出的脚本。
// @encoding utf-8
// @include http://*n.baidu.com/s/*
// @include http://*n.baidu.com/disk/home*
// @include http://*n.baidu.com/share/link*
// @include https://*n.baidu.com/s/*
// @include https://*n.baidu.com/disk/home*
@ialhashim
ialhashim / fitting3D.cpp
Created November 14, 2014 23:17
Fitting 3D points to a plane or a line
template<class Vector3>
std::pair<Vector3, Vector3> best_plane_from_points(const std::vector<Vector3> & c)
{
// copy coordinates to matrix in Eigen format
size_t num_atoms = c.size();
Eigen::Matrix< Vector3::Scalar, Eigen::Dynamic, Eigen::Dynamic > coord(3, num_atoms);
for (size_t i = 0; i < num_atoms; ++i) coord.col(i) = c[i];
// calculate centroid
Vector3 centroid(coord.row(0).mean(), coord.row(1).mean(), coord.row(2).mean());
@nicomgd
nicomgd / getOpenFileName.py
Created November 5, 2015 12:11
win32 GetOpenFileName using ctypes
import ctypes
import ctypes.wintypes as wintypes
LPOFNHOOKPROC = ctypes.c_voidp # TODO
LPCTSTR = LPTSTR = ctypes.c_wchar_p
class OPENFILENAME(ctypes.Structure):
_fields_ = [("lStructSize", wintypes.DWORD),
("hwndOwner", wintypes.HWND),
("hInstance", wintypes.HINSTANCE),
@rplacd
rplacd / optimus.md
Last active January 29, 2024 10:34
Enabling Optimus on your desktop Nvidia GPU.

Enabling Optimus support for your desktop GPU

Windows 10 users: you won't need this guide. NVidia has made signed drivers available with the modifications outlined here, although it's been said you'll have to get them from third-party vendors - distributing them like they do with notebook GPU drivers. I use drivers bundled with the Razer Core enclosure.

From efdfdede52181591db3d85a8622bb79a1fb1262b Mon Sep 17 00:00:00 2001
From: Hamster Tian <haotia@gmail.com>
Date: Tue, 19 Apr 2016 09:08:21 +0800
Subject: [PATCH] Fix non-aligned memory access in ConvertAnyFormat
* Log indicated that the DOUBLE(Fmt=12) format was affected,
not sure if other formats are affected though.
Change-Id: I10b29bd54d350153fddd544e8a43711c2c48bb51
---
@huxuan
huxuan / Makefile
Last active February 26, 2023 17:33
Hello World for LuaJIT FFI/C++ binding.
all: lib run
lib:
g++ -shared -fPIC -o libhello.so libhello.cpp hello.cpp
run:
luajit main.lua
clean:
rm *.so