Skip to content

Instantly share code, notes, and snippets.

View glowinthedark's full-sized avatar

glowinthedark glowinthedark

  • URLError: <urlopen error [Errno 8] nodename nor servname provided, or not known>
  • HTTPError: HTTP Error 403: Forbidden
View GitHub Profile
@glowinthedark
glowinthedark / NSAuthorization.h
Created October 8, 2023 12:06 — forked from TomLiu/NSAuthorization.h
Ask for privilege to execute command
//
// NSAuthorization.h
// OSXvnc
//
// Created by Jonathan Gillaspie on Fri Dec 12 2003.
// Copyright (c) 2003 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
package my.example.compat;
/*
* NOTICE: modified since 2023 and later.
*
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@glowinthedark
glowinthedark / build-mpv_silicon.sh
Created February 14, 2023 14:48 — forked from dbrookman/build-mpv_silicon.sh
How to build mpv & mpv.app on an Apple silicon (M1 / M2) Mac
#!/usr/bin/env bash
# builds mpv & mpv.app on Apple silicon (M1 / M2) Macs
# run this script from the root directory of the mpv repo
# if anything fails, gtfo
set -ex
meson setup build
meson compile -C build
from fairseq.models.transformer import TransformerModel
zh2en = TransformerModel.from_pretrained(
'/path/to/checkpoints',
checkpoint_file='checkpoint_best.pt',
data_name_or_path='data-bin/wmt17_zh_en_full',
bpe='subword_nmt',
bpe_codes='data-bin/wmt17_zh_en_full/zh.code'
)
zh2en.translate('你好 世界')
@glowinthedark
glowinthedark / whisper-mock-en.ipynb
Created November 23, 2022 15:55 — forked from Kazuki-tam/whisper-mock-en.ipynb
whisper-mock-en.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@glowinthedark
glowinthedark / how-to-find-forks-of-deleted-repo.md
Created November 14, 2022 21:51 — forked from rjeczalik/how-to-find-forks-of-deleted-repo.md
How to find forks of a deleted repository?
@glowinthedark
glowinthedark / whisper-transcribe.bash
Created November 14, 2022 13:10 — forked from DaniruKun/whisper-transcribe.bash
Transcribe (and translate) any VOD (e.g. from Youtube) using Whisper from OpenAI and embed subtitles!
#!/usr/bin/env bash
# Small shell script to more easily automatically download and transcribe live stream VODs.
# This uses YT-DLP, ffmpeg and the CPP version of Whisper: https://github.com/ggerganov/whisper.cpp
# Use `./transcribe-vod help` to print help info.
# MIT License
# Copyright (c) 2022 Daniils Petrovs
@glowinthedark
glowinthedark / python_request_create_gist.py
Created November 11, 2022 22:57 — forked from joshisumit/python_request_create_gist.py
Create GIST from your python code with python requests module and OAuth token.
'''
HTTP Reuests has following parameters:
1)Request URL
2)Header Fields
3)Parameter
4)Request body
'''
#!/usr/bin/env python
import requests
@glowinthedark
glowinthedark / lxml_examples.py
Created October 27, 2022 14:51 — forked from IanHopkinson/lxml_examples.py
Examples of xpath queries using lxml in python
#!/usr/bin/env python
# encoding: utf-8
import lxml.etree
import lxml.html
import requests
xml_sample = """<?xml version="1.0" encoding="UTF-8"?>
<foo:Results xmlns:foo="http://www.foo.com" xmlns="http://www.bah.com">
<foo:Recordset setCount="2">
@glowinthedark
glowinthedark / README.md
Last active September 23, 2022 14:04 — forked from cuth/README.md
Font Size Bookmarklet

Font Size Bookmarklet

Code

javascript:(function(){'use strict';var getFontSize=function(el){return parseFloat(getComputedStyle(el,null)['font-size']);};document.addEventListener('wheel',function(e){if(!e.altKey)return;e.preventDefault();var el=e.target;var parent=el.parentElement;var size=getFontSize(el);while(parent&&size===getFontSize(parent)){el.style.fontSize='inherit';el=parent;parent=parent.parentElement;}
if(e.wheelDelta>0){size+=1;}else{size-=1;}
console.log(size);el.style.fontSize=size+'px';el.style.lineHeight='1.2em';});}());