Skip to content

Instantly share code, notes, and snippets.

View mahasak's full-sized avatar
🐻
PapaBear online !!

Max Pijittum mahasak

🐻
PapaBear online !!
View GitHub Profile
@mahasak
mahasak / check_python_version.py
Created May 15, 2019 04:46
Check Python Version
from platform import python_version
print(python_version())
@mahasak
mahasak / gist:fb7b4b0fd6b229e3e3f87133c6383903
Created April 25, 2019 02:58
remove spolier on facebook
const banList = ['avenger', 'infinity', 'endgame'];
const rule = new RegExp(banList.join('|'),'i')
setInterval(function() {
Array.from(document.querySelectorAll('[role="article"]'))
.filter(d => rule.test(d.innerText))
.forEach(d => d.remove())
}, 2000)
@mahasak
mahasak / start_jenkins.sh
Created February 4, 2019 13:19
setup jenkins docker
docker run -u root --rm -d -p 8080:8080 -p 50000:50000 -v $HOME/dockers/jenkins:/var/jenkins_home -v /var/run/docker.sock:/var/run/docker.sock --name jenkins_dev jenkinsci/blueocean
@mahasak
mahasak / extension.ts
Last active January 12, 2019 16:46
VS Code - extension scaffold
import * as vscode from 'vscode';
export function activate(context: vscode.ExtensionContext) {
console.log('Congratulations, your extension "idenExt" is now active!');
let disposable = vscode.commands.registerCommand('extension.helloWorld', () => {
vscode.window.showInformationMessage('Hello World!');
});
context.subscriptions.push(disposable);
@mahasak
mahasak / package.json
Created January 12, 2019 11:14
VS-CODE-Extension-Sample
{
"name": "bigbears-toolbox",
"displayName": "BigBears Toolbox",
"description": "BigBears Toolbox",
"version": "0.0.1",
"publisher": "bigbears",
"author": {
"name": "Mahasak Pijittum"
},
"repository": {"url": "https://github.com/mahasak/bigbear-toolbox-vscode"},
@mahasak
mahasak / reactive_hangman.py
Last active September 23, 2018 17:28
Reactive Hangman
from rx import Observable, Observer
import json
import unittest
from rx.testing import TestScheduler, ReactiveTest
from rx.core import Observer, ObservableBase, Observable
from rx.subjects import Subject
MAX_LIVE = 7
class game_status:
@mahasak
mahasak / hangman-1.py
Last active September 22, 2018 05:52
hangman-challenge-1
def hangman(secret_word, letters):
max_score = 7
return max_score - len([ch for ch in letters if ch not in secret_word]) > 0
secret = "bigbears"
tries = ['a','b', 'c', 'd', 'e', 'f', 'g', 'h']
print(hangman("bigbears",tries))
@mahasak
mahasak / keybase.md
Created September 15, 2018 12:41
keybase.md

Keybase proof

I hereby claim:

  • I am mahasak on github.
  • I am mahasak (https://keybase.io/mahasak) on keybase.
  • I have a public key ASCt9xcks3C7Mt7Q6t5hdIrr4H-unFSMgnUJdX56qg6HIAo

To claim this, I am signing this object:

@mahasak
mahasak / prediction.py
Created September 13, 2018 16:27
pytorch vision image prediction
# Resize the input image nad preprocess it.
image = T.Resize(target_size=(224, 224))(image)
image = T.ToTensor()(image)
# Convert to Torch.Tensor and normalize.
image = T.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])(image)
with torch.no_grad():
image = torch.autograd.Variable(image[None])
@mahasak
mahasak / load_model.py
Created September 13, 2018 16:19
Pytorch load model
import torch
from torch import nn
from torchvision.models import resnet50
def load_model():
global model
model = resnet50(pretrained=False)
model_path = "./models/resnet50-19c8e357.pth"
checkpoint = torch.load(model_path)
model.load_state_dict(checkpoint)