Skip to content

Instantly share code, notes, and snippets.

@ityonemo
ityonemo / test.md
Last active April 25, 2024 10:23
Zig in 30 minutes

A half-hour to learn Zig

This is inspired by https://fasterthanli.me/blog/2020/a-half-hour-to-learn-rust/

Basics

the command zig run my_code.zig will compile and immediately run your Zig program. Each of these cells contains a zig program that you can try to run (some of them contain compile-time errors that you can comment out to play with)

@akexorcist
akexorcist / buddhist-year.js
Last active April 25, 2024 10:20
MomentJS with Buddhist year
module.exports = {
toBuddhistYear: (moment, format) => {
var christianYear = moment.format('YYYY')
var buddhishYear = (parseInt(christianYear) + 543).toString()
return moment
.format(format.replace('YYYY', buddhishYear).replace('YY', buddhishYear.substring(2, 4)))
.replace(christianYear, buddhishYear)
}
}
@ahy4
ahy4 / README.md
Last active April 25, 2024 10:18
amazonにサクラチェッカーをiframeで表示する

これはなにか

amazonのページにサクラチェッカーを埋め込む

https://i.imgur.com/od4D6c3.png

かなり雑に作ったので、iframe内表示領域とか異常系を特に意識していない

使い方

@sxiii
sxiii / remove.sh
Created October 5, 2020 05:35
Docker Swarm - Remove all Down nodes automatically
#!/bin/bash
# Requirements: linux, docker, grep, awk
# This script removes all "Down" (off) nodes from Docker Swarm
# Useful to clean stuff from time to time, if you have auto-joining nodes for example
sudo docker node rm $(sudo docker node ls | grep Down | awk -F" " '{ print $1 }')

Get pretrained weights:

wget https://dl.fbaipublicfiles.com/detr/detr-r50-e632da11.pth

Remove class weights

checkpoint = torch.load("detr-r50-e632da11.pth", map_location='cpu')
del checkpoint["model"]["class_embed.weight"]
del checkpoint["model"]["class_embed.bias"]
torch.save(checkpoint,"detr-r50_no-class-head.pth")
@PurpleVibe32
PurpleVibe32 / vmwk17key.txt
Last active April 25, 2024 10:17
Free VMware Workstation Pro 17 full license keys
Install VMWare Workstation PRO 17 (Read it right. PRO!)
Also, these keys might also work with VMWare Fusion 13 PRO. Just tested it.
Sub to me on youtube pls - PurpleVibe32
if you want more keys - call my bot on telegram. @purector_bot (THE BOT WONT REPLY ANYMORE) - Or: https://cdn.discordapp.com/attachments/1040615179894935645/1074016373228978277/keys.zip - the password in the zip is 102me.
---
This gist can get off at any time.
PLEASE, DONT COPY THIS. IF YOU FORK IT, DONT EDIT IT.
*If you have a problem comment and people will try to help you!
*No virus
@chiang-yuan
chiang-yuan / 2023-07-09-latex-matplotlib-on-HPCs.md
Last active April 25, 2024 10:09
Use latex with matplotlib on HPCs where you can't sudo!

Have you ever wanted to use LaTeX with matplotlib? You are definitely not alone. There are many tutorials out there that can guide you through the installation process. Then we can just follow the official documentation to make plots by activating plt.rcParams['text.usetex'] = True.

What we need to do is just installing typical latex by

sudo apt update
sudo apt install texlive # for minimum latex build
sudo apt install dvipng texlive-latex-extra texlive-fonts-recommended # required by matplotlib
@zoellner
zoellner / cognito_oidc_thumbprint.js
Last active April 25, 2024 10:09
node.js script to obtain the thumbprint for a Cognito User Pool to use as OpenID Connect Identity Provider
const openssl = require('openssl-wrapper');
const axios = require('axios');
const config = {
region: 'us-east-1',
userPoolId: 'your-user-pool-id'
};
getThumbprint()
.then(console.log)