Skip to content

Instantly share code, notes, and snippets.

View windviki's full-sized avatar
🍻
Loving craft beer

windviki

🍻
Loving craft beer
View GitHub Profile
@FreddieOliveira
FreddieOliveira / docker.md
Last active November 17, 2024 21:14
This tutorial shows how to run docker natively on Android, without VMs and chroot.

Docker on Android 🐋📱

Edit 🎉

All packages, except for Tini have been added to termux-root. To install them, simply pkg install root-repo && pkg install docker. This will install the whole docker suite, left only Tini to be compiled manually.


Summary

@Rdp3389
Rdp3389 / pwgen-bios-with-i.py
Created January 19, 2020 10:50
generate result for HP serial with "i" error code
print("============================ Insyde H2O BIOS 'i'/'I' error-code ============================")
print("= Insyde H2O BIOS (Acer, HP) System Disabled 'i'/'I' error-code response generator.")
print("= this script meant to solve https://github.com/bacher09/pwgen-for-bios/issues/52 in Python 3")
print("= ")
print("= HP official response to BIOS Password reset: https://support.hp.com/us-en/document/c06368824")
print("============ Start Quote ============")
print("= A forgotten BIOS password cannot be reset by HP. HP is committed to the security and privacy of")
print("= our customers. To resolve a forgotten BIOS password issue, a system board replacement is required,")
print("= and additional customer costs apply. For more information, go to HP Worldwide Limited Warranty and Technical Support.")
print("= https://www8.hp.com/us/en/privacy/limited_warranty.html")
@zhanwenchen
zhanwenchen / export_tf_model.py
Last active November 4, 2024 16:26
Minimal code to load a trained TensorFlow model from a checkpoint and export it with SavedModelBuilder
import os
import tensorflow as tf
trained_checkpoint_prefix = 'checkpoints/dev'
export_dir = os.path.join('models', '0') # IMPORTANT: each model folder must be named '0', '1', ... Otherwise it will fail!
loaded_graph = tf.Graph()
with tf.Session(graph=loaded_graph) as sess:
# Restore from checkpoint
loader = tf.train.import_meta_graph(trained_checkpoint_prefix + '.meta')
@amitkaps
amitkaps / airports.csv
Created August 23, 2018 09:22
Airports
We can't make this file beautiful and searchable because it's too large.
id,name,city,country,iata,icao,latitude,longitude,altitude,timezone,dst,tz,type,source
1,Goroka Airport,Goroka,Papua New Guinea,GKA,AYGA,-6.081689834590001,145.391998291,5282,10,U,Pacific/Port_Moresby,airport,OurAirports
2,Madang Airport,Madang,Papua New Guinea,MAG,AYMD,-5.20707988739,145.789001465,20,10,U,Pacific/Port_Moresby,airport,OurAirports
3,Mount Hagen Kagamuga Airport,Mount Hagen,Papua New Guinea,HGU,AYMH,-5.826789855957031,144.29600524902344,5388,10,U,Pacific/Port_Moresby,airport,OurAirports
4,Nadzab Airport,Nadzab,Papua New Guinea,LAE,AYNZ,-6.569803,146.725977,239,10,U,Pacific/Port_Moresby,airport,OurAirports
5,Port Moresby Jacksons International Airport,Port Moresby,Papua New Guinea,POM,AYPY,-9.443380355834961,147.22000122070312,146,10,U,Pacific/Port_Moresby,airport,OurAirports
6,Wewak International Airport,Wewak,Papua New Guinea,WWK,AYWK,-3.58383011818,143.669006348,19,10,U,Pacific/Port_Moresby,airport,OurAirports
7,Narsarsuaq Airport,Narssarssuaq,Greenland,UAK,BGBW,61.1604995728,-45.4259986877,1
@AlmostGosu
AlmostGosu / confluence-h2-restore.sh
Last active January 3, 2023 19:16
Shell script to recover corrupted Confluence h2 database
#!/bin/bash
# This script has to be run as your confluence user or root
# Create a backup of, and attempt to restore a confluence h2 internal database
# Go home.
cd ~
# Stop confluence
/opt/atlassian/confluence/bin/stop-confluence.sh
# Really though...
@awni
awni / ctc_decoder.py
Last active September 18, 2024 11:44
Example CTC Decoder in Python
"""
Author: Awni Hannun
This is an example CTC decoder written in Python. The code is
intended to be a simple example and is not designed to be
especially efficient.
The algorithm is a prefix beam search for a model trained
with the CTC loss function.
@victor-shepardson
victor-shepardson / pytorch-glumpy.py
Last active October 31, 2024 06:28
using pycuda and glumpy to draw pytorch GPU tensors to the screen without copying to host memory
from contextlib import contextmanager
import numpy as np
import torch
from torch import Tensor, ByteTensor
import torch.nn.functional as F
from torch.autograd import Variable
import pycuda.driver
from pycuda.gl import graphics_map_flags
from glumpy import app, gloo, gl
@evertrol
evertrol / gist:47325e62f8caae1b72ee
Last active February 16, 2021 13:16
Asyncio: cancel a set of coroutines from another coroutine, by stopping the event loop
"""Example to cancel a set of asyncio coroutines (futures),
using one coroutine to signal the event loop to stop.
"""
import asyncio
import logging
from datetime import datetime
from concurrent.futures import CancelledError
@arlukin
arlukin / Result.txt
Last active July 28, 2016 08:26
Benchmark of merging dicts in python.
time 1.6452050209 --- d4 = d1.copy(); d4.update(d2), d4.update(d3)
time 1.69228887558 --- d4 = dict(d1, **d2); d4.update(d3)
time 1.78650903702 --- d4 = {}; d4.update(d1); d4.update(d2), d4.update(d3)
time 1.92449307442 --- d4 = {} for d in (d1, d2, d3): d4.update(d)
time 2.00036215782 --- d4 = dict(d1, **d2); d5=dict(d4, **d3)
time 2.04427695274 --- d4 = dict(d1) for d in (d2, d3): d4.update(d)
time 2.68033099174 --- d4 = reduce(lambda x,y: dict(x, **y), (d1, d2, d3))
time 3.72226691246 --- d4 = dict(chain(*[d.iteritems() for d in (d1, d2, d3)]))
time 4.01872420311 --- d4 = dict(d1.items() + d2.items() + d3.items())
time 4.07779598236 --- d4 = dict(chain.from_iterable(d.iteritems() for d in (d1, d2, d3)))
@toroidal-code
toroidal-code / pacat.c
Created February 4, 2014 05:54
PulseAudio example with callbacks
/***
This file is part of PulseAudio.
Copyright 2004-2006 Lennart Poettering
Copyright 2006 Pierre Ossman <[email protected]> for Cendio AB
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2.1 of the License,
or (at your option) any later version.