Skip to content

Instantly share code, notes, and snippets.

@toru2220
toru2220 / launch.json
Created April 5, 2020 14:29 — forked from philippslang/launch.json
VS Code pytest debugging settings
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: loadbalancer test",
"type": "python",
"request": "launch",
"module": "pytest",
"args": [
"--no-cov"
@toru2220
toru2220 / gist:805ab79acdf0cd1e2f997c3f6f93f5d7
Created June 24, 2019 09:55 — forked from mrtns/gist:78d15e3263b2f6a231fe
Upgrade Chrome from Command Line on Ubuntu
# Install
# via http://askubuntu.com/questions/510056/how-to-install-google-chrome
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
sudo apt-get update
sudo apt-get install google-chrome-stable
# Update
@toru2220
toru2220 / ToastNotification_Windows10.ps1
Created June 22, 2019 05:33 — forked from altrive/ToastNotification_Windows10.ps1
Windows 10 toast notification sample
$ErrorActionPreference = "Stop"
$notificationTitle = "Notification: " + [DateTime]::Now.ToShortTimeString()
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] > $null
$template = [Windows.UI.Notifications.ToastNotificationManager]::GetTemplateContent([Windows.UI.Notifications.ToastTemplateType]::ToastText01)
#Convert to .NET type for XML manipuration
$toastXml = [xml] $template.GetXml()
$toastXml.GetElementsByTagName("text").AppendChild($toastXml.CreateTextNode($notificationTitle)) > $null
@toru2220
toru2220 / GlassFishEmbeddedSample.java
Created December 21, 2016 09:43
組み込みGlassFishのサンプル。v3.1でGlassFishRuntimeが加わった?
package samples.javaee;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import java.io.File;
import java.io.IOException;
import javax.annotation.Resource;
import javax.ejb.EJB;
@toru2220
toru2220 / ContextProfileInitializer.java
Created October 28, 2016 10:22 — forked from shimarin/ContextProfileInitializer.java
jettyで実行されてる時だけ組み込みデータベースを用い、それ以外の時はJNDIを引いてくる Spring Webアプリケーション
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.web.context.ConfigurableWebApplicationContext;
public class ContextProfileInitializer
implements ApplicationContextInitializer<ConfigurableWebApplicationContext> {
public void initialize(ConfigurableWebApplicationContext ctx) {
String profiles = "prod";
if (ctx.getServletContext().getServerInfo().startsWith("jetty")) {
profiles = "dev";
@toru2220
toru2220 / persistence.xml
Created October 20, 2016 07:55 — forked from mortezaadi/persistence.xml
persistence xml configurations for major databases and jpa providers
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<!-- derby -->
@toru2220
toru2220 / app.js
Created May 20, 2016 11:19 — forked from velsa/app.js
Express server used to launch ffmpeg, transcode stream from peerflix and serve it to HTML5 video tag
var express = require('express'),
http = require('http'),
path = require('path'),
child_process = require("child_process");
var app = express();
// Server settings
app.set('port', process.env.PORT || 9999);
app.use(express.favicon());
@toru2220
toru2220 / gmail_check.sh
Created April 5, 2016 11:38 — forked from gdovicak/gmail_check.sh
Script to check for a phrase in the text of an email in gmail.
curl -u <username>:<password> -k --silent "https://mail.google.com/mail/feed/atom" | grep -oi "Wooo" | say -v "Good News"