Skip to content

Instantly share code, notes, and snippets.

View LittleKey's full-sized avatar
💫
Lk@✨

LittleKey LittleKey

💫
Lk@✨
View GitHub Profile
import os
import ycm_core
from clang_helpers import PrepareClangFlags
# Set this to the absolute path to the folder (NOT the file!) containing the
# compile_commands.json file to use that instead of 'flags'. See here for
# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html
# Most projects will NOT need to set this to anything; you can just change the
# 'flags' list of compilation flags. Notice that YCM itself uses that approach.
compilation_database_folder = ''
@LittleKey
LittleKey / LK_Paste
Last active August 29, 2015 14:02
pastebinit 简易封装....
#!/usr/bin/env ruby
#encoding: utf-8
lambda {
weblist = `pastebinit -l`.split("\n").map { |l| "http://" + $1 if /^\s*-\s*(.*?)\s*$/ =~ (l) }\
.delete_if { |l| l == nil }
author = 'LittleKey'
inputfile = []
syntax = 'python'
@LittleKey
LittleKey / xmlWriter.py
Last active August 29, 2015 14:02
参考了Ruby的某XML库撸出来的简易版XML writer啥的...
#!/usr/bin/env python
#encoding: utf-8
import unittest
class XML(object):
def __init__(self, keywordDict={}):
self._keywordDict = keywordDict
@LittleKey
LittleKey / WTF.rb
Created June 24, 2014 20:06
写了半天却没啥用的东西...
#!/usr/bin/env ruby
#encoding: utf-8
module ViewName
def self.included(base)
base.extend ClassMethods
end
module ClassMethods
@LittleKey
LittleKey / Singleton.py
Last active August 29, 2015 14:04
[PD]Singleton
#!/usr/bin/env python
#encoding: utf-8
import unittest
class Singleton(object):
instanceReference = None
def __new__(cls, *args, **kwargs):
@LittleKey
LittleKey / changeTheme.java
Last active August 29, 2015 14:08
[Andorid] set Light/Dark mode [MAGIC!]
// somewhere activity
protected void changeThemeMode(boolean isLight) {
int light = R.style.LightTheme;
int dark = R.style.DarkTheme;
int changeTheme = isLight ? dark : light;
setTheme(changeTheme);
getWindow().setBackgroundDrawable(new ColorDrawable(
changeTheme));
@LittleKey
LittleKey / favorites.py
Last active August 29, 2015 14:09
get favorites questions from stackoverflow
#!/usr/bin/env python
#encoding: utf8
# REQUIREMENT
#
# requests
# pyquery
import requests as rq
import pyquery as pq
@LittleKey
LittleKey / re_except_words.py
Last active August 29, 2015 14:10
for generate regular expression of match all allow char and except assign words
#!/usr/bin/env python
# encoding: utf-8
def re_except_words(allowChar, *args):
rltList = []
maxLength = max(map(len, args))
for length in xrange(1, maxLength + 1):
tmp = "(?!{exceptChar}){allowChar}{length}".format(
@LittleKey
LittleKey / player.py
Created January 2, 2015 14:13
萌否电台的CL播放器
#!/usr/bin/env python
# encoding: utf-8
from src import MoeFou
import os
import sys
#import pygame
#import requests
import time
/*
* Copyright (C) 2014 skyfish.jy@gmail.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software