This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
##source from https://github.com/swdyh/quilt | |
require 'digest/sha1' | |
module Quilt | |
SALT = '' | |
PATCHES = [[0,4,24,20,0],[0,4,20,0],[2,24,20,2],[0,2,22,20,0],[2,14,22,10,2],[0,14,24,22,0],[2,24,22,13,11,22,20,2],[0,14,22,0],[6,8,18,16,6],[4,20,10,12,2,4],[0,2,12,10,0],[10,14,22,10],[20,12,24,20],[10,2,12,10],[0,2,10,0],[]] | |
CENTER_PATCHES = [0,4,8,15] | |
PATCH_SIZE = 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'adwords_api' | |
def get_keyword_ideas(keyword_text) | |
adwords = AdwordsApi::Api.new | |
targeting_idea_srv = adwords.service(:TargetingIdeaService, API_VERSION) | |
selector = { | |
:idea_type => 'KEYWORD', | |
:request_type => 'IDEAS', | |
:requested_attribute_types => | |
['KEYWORD_TEXT', 'SEARCH_VOLUME', 'CATEGORY_PRODUCTS_AND_SERVICES' , 'AVERAGE_CPC'], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'yaml' | |
require 'awesome_print' | |
require 'open3' | |
###### keys diff start | |
def flat_hash(hash , flag = [] , global = {}) | |
return global.update({flag=>hash}) unless hash.is_a?(Hash) | |
hash.each do |key,rnd| | |
flat_hash(rnd,flag+[key],global) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# AOP = Aspect-Oriented Programming | |
module AOP | |
class Error < StandardError | |
attr_accessor :flag | |
attr_accessor :origin_flag | |
attr_accessor :origin # store raw exception | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <signal.h> | |
#include <string.h> | |
#include <unistd.h> | |
#include <stdio.h> | |
#include <sys/socket.h> | |
#include <sys/un.h> | |
#include <stdlib.h> | |
#include <pthread.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bufio" | |
"flag" | |
"fmt" | |
"image" | |
"image/draw" | |
"image/gif" | |
"log" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# License : WTF License | |
# for Rails project & put it at %RAILS_APP%/script/i18n_unused_scanner.rb and exec it | |
# just for fun , only test with OSX | |
require 'yaml' | |
require 'open3' | |
require 'awesome_print' | |
module I18nUnusedScanner | |
SEARCH_PATTERNS = %w(js rb erb html) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- encoding : utf-8 -*- | |
Rails.application.config.session_store( | |
:redis_store, | |
key: "_#{Rails.application.class.parent_name.downcase}_session", | |
expire_after: 2.days, | |
threadsafe: true, | |
url: "redis://127.0.0.1:6379/8", | |
) | |
# Redis session store(serializer by JSON) for Rails 6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"flag" | |
"fmt" | |
"os" | |
"os/exec" | |
"path/filepath" | |
"regexp" |
OlderNewer