Skip to content

Instantly share code, notes, and snippets.

View KazuyaHayashi's full-sized avatar

林 和哉 KazuyaHayashi

  • 日本
  • 東京都
View GitHub Profile
@KazuyaHayashi
KazuyaHayashi / index.js
Created April 23, 2022 06:27
Electron video issue on Udemy
const { app, BrowserWindow } = require('electron')
const path = require('path')
function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600,
})
win.loadURL("https://www.udemy.com/course/fearless-public-speaker-bootcamp-by-ricky-mendoza/");
@KazuyaHayashi
KazuyaHayashi / main.js
Created November 7, 2021 07:58
Minimum code to reproduce `setContentProtection` issue
const { app, BrowserWindow } = require('electron')
const path = require('path')
function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600,
})
win.loadURL("https://www.google.com");
@KazuyaHayashi
KazuyaHayashi / purgeAndroid.txt
Created July 4, 2018 01:25 — forked from tahmidsadik/purgeAndroid.txt
How to completely remove Android Studio from Mac OS X
How to Completely Remove Android Studio
Execute these commands from the terminal
rm -Rf /Applications/Android\ Studio.app
rm -Rf ~/Library/Preferences/AndroidStudio*
rm ~/Library/Preferences/com.google.android.studio.plist
rm -Rf ~/Library/Application\ Support/AndroidStudio*
rm -Rf ~/Library/Logs/AndroidStudio*
@KazuyaHayashi
KazuyaHayashi / test_switch_role.py
Last active January 13, 2016 09:30
Test script for delegation cross account access by switching IAM Role.
import boto3
import random
class S3(object):
def __init__(self, credentials=None):
if credentials:
self.resource = boto3.resource('s3',
aws_access_key_id=credentials['AccessKeyId'],
aws_secret_access_key=credentials['SecretAccessKey'],
--langdef=js
--langmap=js:.js
--regex-js=/(,|(;|^)[ \t]*(var|let|([A-Za-z_$][A-Za-z0-9_$.]+\.)*))[ \t]*([A-Za-z0-9_$]+)[ \t]*=[ \t]*\{/\5/,object/
--regex-js=/(,|(;|^)[ \t]*(var|let|([A-Za-z_$][A-Za-z0-9_$.]+\.)*))[ \t]*([A-Za-z0-9_$]+)[ \t]*=[ \t]*function[ \t]*\(/\5/,function/
--regex-js=/(,|(;|^)[ \t]*(var|let|([A-Za-z_$][A-Za-z0-9_$.]+\.)*))[ \t]*([A-Za-z0-9_$]+)[ \t]*=[ \t]*\[/\5/,array/
--regex-js=/(,|(;|^)[ \t]*(var|let|([A-Za-z_$][A-Za-z0-9_$.]+\.)*))[ \t]*([A-Za-z0-9_$]+)[ \t]*=[ \t]*[^"]'[^']*/\5/,string/
--regex-js=/(,|(;|^)[ \t]*(var|let|([A-Za-z_$][A-Za-z0-9_$.]+\.)*))[ \t]*([A-Za-z0-9_$]+)[ \t]*=[ \t]*(true|false)/\5/,boolean/
--regex-js=/(,|(;|^)[ \t]*(var|let|([A-Za-z_$][A-Za-z0-9_$.]+\.)*))[ \t]*([A-Za-z0-9_$]+)[ \t]*=[ \t]*[0-9]+/\5/,number/
--regex-js=/(,|(;|^)[ \t]*(var|let|([A-Za-z_$][A-Za-z0-9_$.]+\.)*))[ \t]*([A-Za-z0-9_$]+)[ \t]*=[ \t]*.+([,;=]|$)/\5/,variable/
--regex-js=/(,|(;|^)[ \t]*(var|let|([A-Za-z_$][A-Za-z0-9_$.]+\.)*))[ \t]*([A-Za-z0-9_$]+)[ \t]*[ \t]*([,;]|$)/\5/,variable/
$scope.safeApply = function(fn) {
var phase = this.$root.$$phase;
if(phase == '$apply' || phase == '$digest')
this.$eval(fn);
else
this.$apply(fn);
};
// OR
@KazuyaHayashi
KazuyaHayashi / application.py
Last active December 12, 2015 06:29
get login user's information by OAuth2 Authentication. check user is admin by access to provisioning API with JWT.
import flask
import logging
import json
from flask import request, redirect
import gdata.gauth
import gdata.apps.service
import gdata.apps.groups.service
import gdata.auth
from gdata.apps.service import AppsForYourDomainException
@KazuyaHayashi
KazuyaHayashi / jwtutils.py
Created February 7, 2013 02:44
utility for JWT.
import base64
import json
import urllib
import atom.http_core
from oauth2client import client
class Error(Exception):
def __str__(self):
return "Error: %s" % self.error_message
@KazuyaHayashi
KazuyaHayashi / util.py
Created February 6, 2013 02:36
utility for google api XML feed.
import functools
import logging
from django.utils import simplejson
def get_json_from_feed(user_feed):
"""Constructs and returns a JSON object from the given feed object
Args:
user_feed: A gdata.apps.UserFeed object
@KazuyaHayashi
KazuyaHayashi / UnreadMessageCounter.py
Created November 30, 2012 05:36
IMAP with XOAuth2 and Gmail Inbox Feed with OAuth2
#!/usr/bin/env python2.6
import base64
import sys
import json
import imaplib
import urllib
from optparse import OptionParser
import atom.http_core