Skip to content

Instantly share code, notes, and snippets.

@marufeuille
marufeuille / file0.txt
Last active July 19, 2016 04:03
BLESerial2を使って、Arduinoからセンサーデータを読みだしてみる ref: http://qiita.com/marufeuille/items/7da0ee1eb726847e6aea
void setup() {
Serial.begin(9600);
}
void loop() {
Serial.write("hello");
delay(1000);
}
@marufeuille
marufeuille / file0.conf
Last active July 26, 2016 13:03
AWSのElasticSearchのkibanaにnginxでBasic認証をかける ref: http://qiita.com/marufeuille/items/cb0c98fd0134cc1ae174
server {
server_name XXXXXX.ap-northeast-1.compute.amazonaws.com;
location / {
proxy_pass http://XXXXXXX.ap-northeast-1.es.amazonaws.com/;
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/.htpasswd;
}
}
[
{
"SharedName": "Share1",
"SharedDirectoryPath": "E:\\shares1\\",
"PermitAccount": "Everyone",
"Permission": "Full",
"Quota": "500mb",
"VSS": {
"On": "E:",
"Size": "50%"
$zippath = "c:\PSWindowsUpdate.zip"
Invoke-WebRequest "https://gallery.technet.microsoft.com/scriptcenter/2d191bcd-3308-4edd-9de2-88dff796b0bc/file/41459/43/PSWindowsUpdate.zip" -Outfile $zippath
$zipfile = (new-object -com shell.application).Namespace($zippath)
$destinationPath = "$env:WINDIR\System32\WindowsPowerShell\v1.0\Modules"
$destination = (new-object -com shell.application).Namespace($destinationPath)
$destination.CopyHere($zipfile.Items())
Import-Module PSWindowsUpdate
Get-WUInstall -AcceptAll -IgnoreReboot -AutoSelectOn -Confirm
Remove-Item $zippath
$targets = @("08-00-27-9A-AB-94")
$nics = Get-NetAdapter
foreach ($nic in $nics) {
if ($targets -contains $nic.MACAddress) {
New-NetIPAddress -InterfaceIndex $nic.IfIndex -IPAddress "192.168.0.1" -AddressFamily IPv4 -PrefixLength 24
}
}
$header = @{
"X-IIJmio-Developer" = "XXXXXX";
"X-IIJmio-Authorization" = "XXXXX";
}
$result = Invoke-WebRequest -Headers $header https://api..jp/mobile/d/v1/log/packet/
$content = $result | ConvertFrom-Json
Write-Host $result
Write-Host $content
foreach ($line in $content.packetLogInfo) {iijmio
Write-Host $line.hddServiceCode
exports.handler = function (event, context, callback) {
var https = require('https');
var AWS = require('aws-sdk');
var imsi = 'PUT YOUR IMSI';
var to_mail_addr = 'PUT YOUR MAIL ADDRESS YOU RECIEVED ALERT MAIL';
var from_mail_addr = 'PUT YOUR MAIL ADDRESS YOU SEND ALERT MAIL(SES)';
var soracom_key = 'PUT YOUR SORACOM API KEY'
var soracom_token = 'PUT YOUR SORACOM API TOKEN'
import slackweb
def lambda_handler(event, context):
slack = slackweb.Slack(url="YOUR WEBHOOK URL PUTS HERE")
slack.notify(text="Hello, World!!", channel="#YOUR CHANNEL HERE", username="USERNAME HERE", icon_emoji=":smiling_imp:")
return "succeeded"
@marufeuille
marufeuille / Dockerfile
Created July 20, 2019 14:16
for JupyterHub
FROM jupyter/scipy-notebook
USER root
RUN mkdir -p /root/workspace/personal /root/workspace/project
WORKDIR /root/workspace
CMD ["jupyterhub-singleuser", "--allow-root"]
@marufeuille
marufeuille / jupyterhub_config.py
Created July 20, 2019 14:18
jupyterhub_config.py
image_name = "YOUR_CONTAINER_IMAGE_NAME"
network_name = "YOUR_DOCKER_NETWORK_NAME"
c.JupyterHub.authenticator_class = 'jupyterhub.auth.PAMAuthenticator'
from jupyter_client.localinterfaces import public_ips
c.JupyterHub.hub_ip = public_ips()[0]
c.JupyterHub.port = 8888
from dockerspawner import DockerSpawner