View regexp_test.vba
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
Sub regexp_test() | |
Dim reg As Object | |
Set reg = CreateObject("VBScript.RegExp") | |
reg.Global = True | |
reg.Pattern = "^([^\(]+)\(([^\)]+)\)" | |
Dim output As String | |
output = reg.Replace("京急1000形1890番台(Le Ciel)", "$2 $1") | |
Debug.Print output | |
End Sub |
View mongodb_var_lib_nfs_fs.te
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
module mongodb_var_lib_nfs 1.0; | |
require { | |
type mongod_t; | |
type var_lib_nfs_t; | |
class dir search; | |
class file { getattr read open }; | |
} | |
#============= mongod_t ============== |
View mongodb_sysctl_fs.te
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
module mongodb_sysctl_fs 1.0; | |
require { | |
type mongod_t; | |
type sysctl_fs_t; | |
class dir search; | |
class file { getattr read open }; | |
} | |
#============= mongod_t ============== |
View uploadToIpfs.js
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
// See https://pandanote.info/?p=8723 for details. | |
import * as fs from 'fs'; | |
import axios from 'axios'; | |
import FormData from 'form-data'; | |
function getBoundary(header) { | |
var tmpct = header['content-type'].split(/;/); | |
var boundary = tmpct.filter(function(e) { | |
return e.trim().startsWith("boundary="); | |
}); |
View openvpn_start.sh
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
#!/bin/sh | |
modprobe tun | |
cd /jffs/openvpn/conf | |
nohup /usr/sbin/openvpn --config client.conf 2>&1 >/dev/null & |
View tfidf.py.sample
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
# TF | |
aa = bow.copy() | |
np.set_printoptions(threshold=np.inf,formatter={'float': '{:.8f}'.format}) | |
for i in range(0,dim[0]): | |
ar = bow.getrow(i) | |
rowsum = np.matrix.sum(ar.todense()) | |
arr = ar/rowsum | |
aa[i] = arr | |
# IDF(ln) |
View freq2matrix.py.example
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
with open(inputfile, encoding='utf-8') as fh: | |
freqlist = json.load(fh) | |
words = [] | |
articleids = [] | |
for k,v in freqlist.items(): | |
words.append(k) | |
for vv in v: | |
a,f = vv.split(",") |
View startipfs.sh
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
#!/bin/bash | |
# | |
# See https://pandanote.info/?p=8205 for details. | |
# | |
MODE="start" | |
if [ -n "$1" ]; then | |
MODE="stop" | |
fi |
View ipfs.service
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
[Unit] | |
Description=Ipfs | |
After=network-online.target | |
[Service] | |
User=panda | |
WorkingDirectory=/home/panda | |
OOMScoreAdjust=-1000 | |
ExecStart=/usr/local/bin/ipfs daemon --enable-gc --enable-namesys-pubsub | |
ExecStop=/usr/bin/pkill --signal SIGINT ipfs | |
[Install] |
View adjust_config_sample.sh
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
#!/bin/sh | |
# See https://pandanote.info/?p=8118 for details. | |
chown -R nginx /etc/wordpress | |
chown -R nginx /var/lib/php/session | |
chown -R nginx /var/lib/php/wsdlcache/ | |
chown -R nginx /var/lib/php/opcache/ | |
chown -R nginx /usr/share/wordpress/wp-content/uploads/ | |
chown nginx:nginx /var/log/nginx |
NewerOlder