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
import java.util.Arrays; | |
/** | |
* Created by le-doude on 14/06/19. | |
* <p/> | |
* Did you know it is possible to find the longest palindrom in a char sequence in O(N) time. | |
* Here is the solution: Manacher's algorithm. | |
* http://en.wikipedia.org/wiki/Longest_palindromic_substring | |
*/ | |
public class ManacherAlgorithm { |
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
# Depth-first search (DFS) is an algorithm for traversing or | |
# searching a tree, tree structure, or graph. One starts at | |
# the root (selecting some node as the root in the graph case) | |
# and explores as far as possible along each branch before backtracking. | |
# | |
# A graph can be represented by its adjacency matrix G, | |
# where G[i][j] == 1 if there is an edge between | |
# vertices i and j and 0 otherwise. | |
# | |
# Below Graph in diagram http://i.imgur.com/sV1UzUn.png |
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
#!/usr/bin/env python | |
from pymarkov import markov | |
from random import choice | |
import doctest | |
import argparse | |
class Generate: | |
""" A song generator. Generate takes input (musician, album) and returns | |
a version of that musician's songs. |
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
%define name mecab | |
%define version 0.996 | |
%define release el6.4 | |
Summary: Yet Another Part-of-Speech and Morphological | |
Name: %{name} | |
Version: %{version} | |
Release: %{release} | |
Source0: https://mecab.googlecode.com/files/mecab-%{version}.tar.gz | |
License: GPL/LGPL/BSD |
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
class Class: | |
pass | |
x = Class() | |
x.something = 42 | |
print(x.something) # 42 |
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
#!/bin/sh | |
# | |
# Written by Denis Vazhenin <denis.vazhenin@me.com> | |
# | |
# This script was ported from Debian/Ubuntu version of start script for Gitlab: | |
# https://raw.github.com/gitlabhq/gitlabhq/master/lib/support/init.d/gitlab | |
# | |
# PROVIDE: gitlab | |
# REQUIRE: NETWORKING SERVERS DAEMON LOGIN | |
# KEYWORD: shutdown |
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
#!/bin/sh | |
# | |
# Downloads and installs the startssl CA certs into the global Java keystore | |
# on Alpine Linux. | |
# | |
# Check if JAVA_HOME is set | |
[ "$JAVA_HOME" = "" ] && echo "ERROR: JAVA_HOME must be set" && exit 1 | |
# Check if cacerts file is present |
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
# This script comes from Pry Everywhere by Luca Pette | |
# http://lucapette.com/pry/pry-everywhere/ | |
# https://github.com/carlhuda/bundler/issues/183#issuecomment-1149953 | |
if defined?(::Bundler) | |
global_gemset = ENV['GEM_PATH'].split(':').grep(/ruby.*@global/).first | |
if global_gemset | |
all_global_gem_paths = Dir.glob("#{global_gemset}/gems/*") | |
all_global_gem_paths.each do |p| | |
gem_path = "#{p}/lib" |
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
/** | |
* allow to define callback wrappers that are protected from accidental multiple calls to resume/resumeWithException | |
* Created by daely on 3/30/2017. | |
*/ | |
class WrappedContinuation<T>(val c: Continuation<T>) : Continuation<T> { | |
var isResolved = false | |
override val context: CoroutineContext | |
get() = c.context | |
override fun resume(value: T) { |
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
# Signal catching | |
def shut_down | |
puts "\nShutting down gracefully..." | |
sleep 1 | |
end | |
puts "I have PID #{Process.pid}" | |
# Trap ^C | |
Signal.trap("INT") { |
OlderNewer