Skip to content

Instantly share code, notes, and snippets.

View moznion's full-sized avatar

moznion moznion

View GitHub Profile
package main
import (
"log"
"math/rand"
"time"
)
type Promise struct {
done bool
@tegansnyder
tegansnyder / disable mcafee endpoint protection.md
Last active October 29, 2024 13:49
Disable McAffee Endpoint Protection OSX

method 1

sudo /usr/local/McAfee/AntiMalware/VSControl stopoas

alternatively

sudo defaults write /Library/Preferences/com.mcafee.ssm.antimalware.plist OAS_Enable -bool False
sudo /usr/local/McAfee/AntiMalware/VSControl stop
sudo /usr/local/McAfee/AntiMalware/VSControl reload
@hayajo
hayajo / Vagrantfile
Last active August 29, 2015 14:07
Dockerの最新stableを利用するためのVagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# see. https://docs.docker.com/installation/ubuntulinux/#ubuntu-trusty-1404-lts-64-bit
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.provision :shell, inline: <<-"EOF"
@hayajo
hayajo / main.go
Last active October 19, 2018 07:00
os.Mkdir(All)で01777なパーミッションのディレクトリを作成
package main
import (
"os"
"syscall"
)
func main() {
oldMask := syscall.Umask(0)
os.Mkdir("hoge_01", 01777) // NG
@motemen
motemen / Ojisan-Patterns.md
Last active March 7, 2025 08:19
おじさんパターン集
  • その面白そうな話、私も参加していいよね?なぜなら私は無条件に受け入れられているからおじさん(闖入おじさん) #おじさんパターン
  • 後出し難癖おじさん #おじさんパターン
  • 困難は成長のチャンス!だから君たちに成長の機会をあげようおじさん (成長おじさん) #おじさんパターン
  • あらゆる事案に一般論コメントおじさん #おじさんパターン
  • 俺ってあらゆることに精通してるじゃん?だから力になるよおじさん (精通おじさん) #おじさんパターン
diff --git a/lib/Plack/Request/WithEncoding.pm b/lib/Plack/Request/WithEncoding.pm
index 45d3d3f..aa8f36b 100644
--- a/lib/Plack/Request/WithEncoding.pm
+++ b/lib/Plack/Request/WithEncoding.pm
@@ -81,11 +81,34 @@ sub _decode_parameters {
my @flatten = $stuff->flatten;
my @decoded;
while ( my ($k, $v) = splice @flatten, 0, 2 ) {
- push @decoded, $encoding->decode($k), $encoding->decode($v);
+ push @decoded, $self->__decode($encoding, $k), $self->__decode($encoding, $v);
@hisaichi5518
hisaichi5518 / JSON.pm
Created March 18, 2014 09:31
HTTP::Body::JSON
package HTTP::Body::JSON;
use strict;
use warnings;
use parent qw(HTTP::Body);
use JSON::XS;
use HTTP::Body;
use Encode qw(encode_utf8);
# based on tokuhirom-san's code
@diverted247
diverted247 / vuejs.d.ts
Created March 15, 2014 20:06
Early Version of VueJS Type Defintion
declare var Vue: VueStatic;
interface VueObject{
}
interface VueMethods{
[n: string]: Function;
}
interface VueAttributes{
@hayajo
hayajo / 00.md
Last active March 8, 2020 16:05
NDS#36 Go言語入門

SQLインジェクション対策について

教育的な観点ではなく実務的な観点から、僕の考えをまとめてみる。UTF-8 を利用し、SET NAMES を利用していなくて mysql で、クライアントプリペアドステートメントなケースを想定している。

SQL インジェクションとは

$foo=$_POST[‘id’];
query(“SELECT * FROM foo WHERE id=$foo”);

のように外部からの文字列をそのまま使用してクエリを組みたてたときに、意図せぬ SQL を発行されてしまう脆弱性のことである。