Skip to content

Instantly share code, notes, and snippets.

View mgttt's full-sized avatar
deadbeef

datakk mgttt

deadbeef
View GitHub Profile
import torch
import torch.nn as nn
import torch.optim as optim
import numpy as np
# 判断是否有cuda支持
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
class MeanStdRNN(nn.Module):
def __init__(self, input_size, hidden_size):
@mgttt
mgttt / sympy-latex-maths.md
Last active June 26, 2024 03:14
sympy-latex-maths
Disp Sympy LaTeX maths
$x^2$ x**2 $x^2$ (x^2)
$\sin(x)$ sin(x) $\sin(x)$ (\sin(x))
$\int f dx$ integrate(f, x) $\int f dx$ (\int f dx)
@mgttt
mgttt / mymath.md
Last active July 7, 2023 15:29
interesting maths with python
approximation function for natural logarithm
# ln=(x,a=2**32)=>a*x**(1/a)-a
#ln=lambda x,a=1<<32:a*x**(1/a)-a
ln=lambda x,a=1<<32:a*(x**(1/a)-1)

>>> numpy.log(400) - ln(400)
-6.776018235399306e-08

@mgttt
mgttt / README.md
Created March 19, 2022 06:23 — forked from BrandonMiller97528/README.md
A deleted commit from the node-ipc repository. You can find the original commit here: https://github.com/RIAEvangelist/node-ipc/blob/847047cf7f81ab08352038b2204f0e7633449580/dao/ssl-geospec.js **WARNING: THIS IS LIVE MALWARE. RUN IT AT YOUR OWN RISK.**
@mgttt
mgttt / mysql table size etc
Last active October 30, 2020 11:38
mysql table size etc
SELECT TABLE_SCHEMA,TABLE_NAME,TABLE_ROWS,DATA_LENGTH,INDEX_LENGTH FROM information_schema.TABLES
where DATA_LENGTH+INDEX_LENGTH >0 and TABLE_SCHEMA not in ('mysql','sys','information_schema');
select * from information_schema.TABLES limit 1;
@mgttt
mgttt / mysql kill sleep
Created October 19, 2020 13:52
mysql kill sleep
select @to_kill_proc_list:=GROUP_CONCAT(CONCAT('KILL ',ID) SEPARATOR ';') q FROM information_schema.processlist WHERE Command='Sleep' and Time>5;PREPARE stmt FROM @to_kill_proc_list;EXECUTE stmt;DEALLOCATE PREPARE stmt;
@mgttt
mgttt / admin.lua
Created October 18, 2020 03:00 — forked from maxclark/admin.lua
The illusive read/write splitting lua for the mysql-proxy. Includes connection pooling and read load balancing.
--[[
Copyright 2008, 2010, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@mgttt
mgttt / aliyun-resize.md
Created February 24, 2020 12:04
aliyun resize

sudo bash

apt install cloud-guest-utils
growpart /dev/vdb 1
resize2fs /dev/vdb1

lsblk
df -h
@mgttt
mgttt / GoogleSoftwareUpdate notification removal.md
Last active February 24, 2020 06:50
GoogleSoftwareUpdate OSX

annoying GoogleSoftwareUpdate hint at OSX

sudo /Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/Resources/GoogleSoftwareUpdateAgent.app/Contents/Resources/ksinstall --uninstall