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
@Grab('pircbot:pircbot:1.4.2') | |
import org.jibble.pircbot.*; | |
def (host, port, channel) = ['chat.freenode.net', 6667, 'gitbot'] | |
def bot = [:] as PircBot | |
bot.name = 'groovy_bot' | |
bot.encoding = 'ISO-2022-JP' | |
bot.connect host, port | |
bot.joinChannel channel |
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 <iostream> | |
#include <algorithm> | |
#include <assert.h> | |
#include <vector> | |
#include <map> | |
#include <string> | |
#include <memory> | |
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 System.Random | |
randInRange :: Int -> Int -> IO Int | |
randInRange a b = getStdRandom $ randomR (a, b) | |
ep :: Int -> IO Int | |
ep s = if s /= 3 then randInRange 1 26 else randInRange 1 13 | |
main = |
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
<# | |
.DESCRIPTION | |
This script is for replacing something by pattern in all text files | |
in specific directory and its subdirectories recursively. | |
.PARAMETER word | |
Pattern what we want to replace. | |
.PARAMETER replace | |
Replacement. |
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
param( | |
$place = $PSScriptRoot, | |
$what | |
) | |
$time1 = Get-Date -format HH:mm:ss | |
[array]$list = Get-ChildItem $place -recurse | %{ Write-Host Examining file: $_.fullname; $_ } | ? { $_.psiscontainer -eq $false } | ?{ gc $_.pspath | select-string -pattern $what } | %{ $_.FullName } |
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
param( | |
$place = $PSScriptRoot, | |
$what | |
) | |
$regexPattern = "\\" | |
if($caseSensitive -eq $false) { $regexPattern = "(?i)$regexPattern" } | |
$regex = New-Object System.Text.RegularExpressions.Regex $regexPattern | |
# Function for highlighting pattern in the line. |
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 <iostream> | |
#include <functional> | |
#include <utility> | |
#include <array> | |
#include <map> | |
using namespace std; | |
template< typename F, typename Arg > | |
struct PartialApp { |
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
{-# LANGUAGE OverloadedStrings #-} | |
import Text.Printf | |
import Control.Monad | |
import Data.Char | |
import Data.List | |
import System.IO | |
import Codec.Binary.UTF8.String (utf8Encode) | |
import qualified Data.Text.Encoding as 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
import Network.HTTP | |
import Text.RawString.QQ | |
headers :: [Header] | |
headers = [ | |
Header (HdrCustom "Connection") "keep-alive" | |
,Header (HdrCustom "Accept-Language") ";q=0.8,en-US;q=0.5,en;q=0.3" | |
,Header (HdrCustom "User-Agent") "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36" | |
,Header (HdrCustom "Accept") "application/json, text/javascript, */*; q=0.01" |
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
// MCCME issue 3299 | |
#include <iostream> | |
#include <tuple> | |
auto gcd (int a, int b) -> std::tuple<int, int, int> // <GCD, x, y> | |
{ | |
if (a == 0) | |
{ | |
return std::make_tuple (b, 0, 1); | |
} |
OlderNewer