Skip to content

Instantly share code, notes, and snippets.

View lsongdev's full-sized avatar
👨‍💻

Lsong lsongdev

👨‍💻
View GitHub Profile
@lsongdev
lsongdev / git-recover.sh
Last active February 15, 2016 13:07
recover your git added without commit file back .
#!/bin/bash
#
filename=$(basename $0 ".sh")
mkdir -p $filename
for blob in $(find .git/objects -type f); do
hash=$(echo $blob | cut -c14- | sed 's|/||')
git show $hash | cat > "$filename/$hash"
done
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
</body>
<script type="text/javascript">
from Tkinter import *
def fn(*args):
messagebox.showinfo(content.get())
root = Tk()
root.title("Google")
main = Frame(root)
main.pack()
<!DOCTYPE html>
<html lang="en" >
<head>
<title>Wi-Fi</title>
<style type="text/css">
* {
margin: 0;
padding: 0;
font-family: "Helvetica Neue",Helvetica Neue,Helvetica,Arial,Heiti SC,Hiragino Sans GB,Microsoft Yahei,sans-serif;
}
@lsongdev
lsongdev / RemoteServer.cs
Last active February 11, 2016 14:34
Control Windows7/8/10 volume use IR Remote and UDP Socket
using System;
using System.Diagnostics;
using System.Net;
using System.Net.Sockets;
using System.Runtime.InteropServices;
using System.Text;
namespace RemoteControlServer
{
class RemoteServer
@lsongdev
lsongdev / promiseify.js
Last active January 12, 2016 03:39
warp callback style function to promise .
/**
* [promiseify description]
* @param {[type]} creator [description]
* @return {[type]} [description]
*/
module.exports = function promiseify(creator){
return new Promise(function(accept, reject){
creator.call(this, function(err, res){
if(err) return reject(err);
accept(res);
@lsongdev
lsongdev / promise-retry.js
Last active January 12, 2016 04:25
catch promise error and retry .
const debug = require('debug')('promise-retry');
/**
* [promise-retry: catch promise error and retry]
* @param {[type]} task [description]
* @param {[type]} n [description]
* @param {[type]} timeout [description]
* @return {[type]} [description]
* @source https://gist.github.com/song940/6e3e1ec0380956006cd1
*/
module.exports = function retry(task, n, timeout){
@lsongdev
lsongdev / sentry.sh
Last active January 7, 2016 14:12
send message to sentry by shell script .
#!/usr/bin/env bash
#
#
PROJECT_ID=1
SENTRY_VERSION=7
SENTRY_NAME="sentry-cli"
SENTRY_KEY=5660affd663b4e4e8f0ca25c96dce705
SENTRY_API="http://sentry.lsong.org/api/$PROJECT_ID"
ORIGIN="http://lsong.org"
Host *
ControlPersist yes
ControlMaster auto
ControlPath ~/.ssh/master-%r@%h:%p
@lsongdev
lsongdev / LICENSE.txt
Created November 13, 2015 08:45 — forked from yckart/LICENSE.txt
Domster | Syntactic sugar for DOM-traversing
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2013 Yannick Albert <http://yckart.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE