Skip to content

Instantly share code, notes, and snippets.

@nakagami
nakagami / jabstract.py
Last active April 4, 2021 05:31
Japanese summarization module using LexRank algorithm.
#!/usr/bin/env python
# The MIT License (MIT)
# Copyright © 2015 Recruit Technologies Co.,Ltd.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@nobodyguy
nobodyguy / http_server.ps1
Last active July 9, 2022 15:09
Powershell HTTP server in background thread (could be easily killed)
$ServerThreadCode = {
$listener = New-Object System.Net.HttpListener
$listener.Prefixes.Add('http://+:8008/')
$listener.Start()
while ($listener.IsListening) {
$context = $listener.GetContext() # blocks until request is received
$request = $context.Request
@ericacm
ericacm / Topic.scala
Last active June 25, 2017 06:17
Example Hibernate entity in Scala
/*
* Topic Entity
*/
@Entity
@Table(uniqueConstraints = Array(new UniqueConstraint(columnNames=Array("application_id", "name"))))
@NamedQueries(Array(
new NamedQuery(name="Topic.findAllByApplication", query="from Topic where application=:application"),
new NamedQuery(name="Topic.findByApplicationAndName", query="from Topic where application=:application and name=:name")
))
class Topic {
@snaga
snaga / gist:4179435
Created November 30, 2012 23:25
check_pg_settings.sql
--
-- check_pg_settings.sql
--
-- Copyright(C) 2012 Uptime Technologies, LLC. All rights reserved.
--
SELECT name,
setting,
CASE WHEN setting::integer = 4096 THEN 'WARNING: default value (4096=32MB) is too small.'
WHEN setting::integer < 65536 THEN 'WARNING: too small. (<65536=512MB)'
ELSE 'OK.'