Skip to content

Instantly share code, notes, and snippets.

View accraze's full-sized avatar
👽

A. Craze accraze

👽
  • Zone 8b
View GitHub Profile
@accraze
accraze / gist:a5cde457f95808b902ddd89c3c924ef9
Created December 7, 2022 21:40
Installing snowflake-connector & jpype on Apple M1 ARM
CONDA_SUBDIR=osx-64 conda create -n sagemaker-sklearn python=3.8 numpy pandas --override-channels -c https://repo.anaconda.com/pkgs/snowflake
conda activate sagemaker-sklearn
conda config --env --set subdir osx-64
pip install 'snowflake-connector-python[pandas]' --no-binary snowflake-connector-python
pip install JPype1==1.4.1
# next install x86 jdk
curl https://cdn.azul.com/zulu/bin/zulu17.38.21-ca-jdk17.0.5-macosx_x64.tar.gz -O
tar -xzvf zulu17.38.21-ca-jdk17.0.5-macosx_x64.tar.gz
@accraze
accraze / CHANGELOG.org
Created September 1, 2022 03:59
Keep A Changelog template in org-mode
@accraze
accraze / kfserving-enwiki-damaging-model.py
Last active January 25, 2021 19:52
Using revscoring editquality enwiki damaging model as custom KFServing model.
import kfserving
from revscoring import Model
import mwapi
from revscoring.extractors import api
from typing import List, Dict
class EnWikiDamagingModel(kfserving.KFModel):
def __init__(self, name: str):
super().__init__(name)
@accraze
accraze / predict.py
Created January 23, 2021 00:04
Boosted Trees test model
import os
import shutil
import numpy as np
import pandas as pd
import tensorflow as tf
dftrain = pd.read_csv('https://storage.googleapis.com/tf-datasets/titanic/train.csv')
dfeval = pd.read_csv('https://storage.googleapis.com/tf-datasets/titanic/eval.csv')
MODEL = '1611359327' # update with whatever the train script displays
@accraze
accraze / setup.sh
Created June 10, 2020 00:08
Script to install mediawiki-extension-jade on mediawiki-docker
# After following the instructions in DEVELOPERS.md run this script to install dependencies relevant to Jade
set -eu
git clone https://gerrit.wikimedia.org/r/mediawiki/skins/Vector ./skins/Vector
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/Jade ./extensions/Jade
# Save the default settings from the Mediawiki installation to be added back later.
defaultSettings=`cat LocalSettings.php`
@accraze
accraze / zipf_sinica.py
Last active February 5, 2017 20:07
Create a graph to show frequency distribution for Chinese words
from itertools import *
from pylab import *
from nltk.corpus import sinica_treebank
from string import lower
from collections import Counter
# Count words in sinica treebank
words_with_count = Counter(sinica_treebank.words())
counts = array(words_with_count.values())

Keybase proof

I hereby claim:

  • I am accraze on github.
  • I am accraze (https://keybase.io/accraze) on keybase.
  • I have a public key whose fingerprint is 42E0 04EF E6C0 35CB 9AA1 8DAD E280 B60A E14E 7EA4

To claim this, I am signing this object:

@accraze
accraze / discogs.hs
Created February 14, 2016 00:21
Discogs API Haskell GET Request
module Main where
import Control.Lens
import qualified Data.ByteString.Lazy as BL
import Network.Wreq
main :: IO ()
main = do
response <- get "https://api.discogs.com/releases/249504"
@accraze
accraze / mockedService.test.js
Last active September 7, 2016 19:57
Testing with mocked Angular Services using Jasmine - http://accraze.info/testing-angular-services-using-jasmine/
describe('OrderApp', function() {
describe('Service: MenuResult', function() {
beforeEach(module('OrderApp'));
beforeEach(inject(function($httpBackend) {
mock_response = {
results: [{
_id: "1234567890",
url: "/food/pizza",
title: 'Pizza'
@accraze
accraze / orderPanelTest.js
Last active November 15, 2015 03:13
How to Test AngularJS Directives using Jasmine - http://accraze.info/testing-angularjs-directives-using-jasmine/
describe('orderPanel', function() {
var scope;
element,
beforeEach(module('app'));
beforeEach(inject(function($rootScope, $compile) {
element = angular.element('<order-panel></order-panel>');