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.net.InetAddress | |
object CIDRChecker { | |
/** | |
* Checks if an IP address is within any of the specified CIDR ranges. | |
* This method replicates the behavior of PostgreSQL's `<<= ANY` operator for IP addresses. | |
* | |
* @param cidrs Array of IP addresses or CIDR notation strings (e.g., "192.168.1.0/24") | |
* @param address The IP address to check | |
* @return true if the address is within any of the CIDR ranges, or if the cidrs array is empty. |
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
function doPost(e) { | |
const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheets()[0]; | |
sheet.getRange("1:1").insertCells(SpreadsheetApp.Dimension.ROWS); | |
sheet.getRange(1, 1).setValue((new Date).toLocaleString('ja-JP')); | |
sheet.getRange(1, 2).setValue(e.postData.contents); | |
// send 200 OK status back to confirm receiving webhook | |
var response = HtmlService.createHtmlOutput(); | |
return response; |
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 bash | |
USER=user_name | |
PERSONAL_TOKEN=************************************************* | |
USER_OR_ORG=user_name_or_organization_name | |
REPO=repo_name | |
# can get per max 100 issues | |
curl -u $USER:$PERSONAL_TOKEN -o issues_1.json -# https://api.github.com/repos/$USER_OR_ORG/$REPO/issues?state=all\&page=1\&per_page=100 | |
curl -u $USER:$PERSONAL_TOKEN -o issues_2.json -# https://api.github.com/repos/$USER_OR_ORG/$REPO/issues?state=all\&page=2\&per_page=100 |
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
// tags が multiParams | |
// まず xxxxParams に Seq で入れてしまう | |
def xxxxParams: Params = { | |
val title = params.getOrElse("title", "") | |
val body = params.getOrElse("body", "") | |
val tags = multiParams.get("tags").getOrElse(Seq()).map(_.trim).distinct.filter(_.nonEmpty) | |
Params(Map("title" -> title, "body" -> body, "tags" -> tags)) | |
} | |
// tags についてはカスタムな Seq 用のバリデータ(maxLengths)を適用する | |
def xxxxForm: MapValidator = validation(xxxxParams, |
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 jp.roundrop.quercus.servlet; | |
import com.caucho.quercus.QuercusContext; | |
import com.caucho.quercus.lib.session.QuercusSessionManager; | |
import com.caucho.quercus.servlet.QuercusServlet; | |
import com.caucho.util.Alarm; | |
import org.slf4j.bridge.SLF4JBridgeHandler; | |
import javax.servlet.ServletConfig; | |
import javax.servlet.ServletException; |
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
public CopyManager getCopyManager() throws SQLException { | |
Connection conn = ((JdbcManagerImplementor) jdbcManager).getDataSource().getConnection(); | |
XAConnection xaConn = ((ConnectionWrapperImpl) conn).getXAConnection(); | |
Connection pgConn = xaConn.getConnection(); | |
return ((PGConnection) pgConn).getCopyAPI(); | |
} |
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
<html> | |
<head></head> | |
<body> | |
<input type="text" id="foo" value="" /> | |
</body> | |
</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
function doGet(req) { | |
var result = { ok : 0 }; | |
if (req.parameters.api_key == 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx') { | |
var rows = []; | |
try { rows = JSON.parse(req.parameters.rows) } catch (e) { } | |
if (rows.length) { | |
var ss = SpreadsheetApp.openById('*****************************************'); | |
var sheet = ss.getSheets()[0]; | |
for (var i = 0, len = rows.length; i < len; i++) { |
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
private static final String INDEXED_DELIM = "["; | |
private static final String INDEXED_DELIM2 = "]"; | |
@Override | |
protected void setProperty(Object bean, String name, Object value) { | |
if (bean == null) { | |
return; | |
} | |
int startIndexedIndex = name.indexOf(INDEXED_DELIM); | |
int endIndexedIndex = name.indexOf(INDEXED_DELIM2); |
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 javax.servlet.ServletException; | |
import javax.servlet.http.HttpServletRequest; | |
import javax.servlet.http.HttpServletResponse; | |
import org.apache.struts.action.ActionForm; | |
import org.apache.struts.action.ActionForward; | |
import org.apache.struts.action.ActionMapping; | |
import org.apache.struts.action.ExceptionHandler; | |
import org.apache.struts.config.ExceptionConfig; | |
import org.seasar.struts.config.S2ActionMapping; |
NewerOlder