Skip to content

Instantly share code, notes, and snippets.

`--> TORCH_LOGS="output_code" python optim_repro.py
[WARNING]:Profiler function <class 'torch.autograd.profiler.record_function'> will be ignored
[DEBUG]:Output code:
# AOT ID: ['0_inference']
from ctypes import c_void_p, c_long
import torch
import math
import random
import os
@MANOJ-M-01
MANOJ-M-01 / letterboxd follower Bot.js
Last active May 7, 2024 13:35
Get follower in letterboxd
------------------------------------------------------------------
// Version 3
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
var elements = document.querySelectorAll( 'a[data-recaptcha-action=follow]:not([style*="display: none"]):not([style*="display: none"])' );
async function follow(){
for(const el of elements){
await sleep(2000);
el.click();
@erus
erus / \etc\grub.d\91_tune_demo
Created August 27, 2022 08:47
ARCHWIKI_GRUB_INIT_TUNE
#!/bin/sh
exec tail -n +3 $0
menuentry "INIT_TUNE Demos" {
echo "Close Encounters/5 Tone"
play 480 900 2 1000 2 800 2 400 2 600 3
echo "Fur Elise (note long)"
play 480 420 1 400 1 420 1 400 1 420 1 315 1 370 1 335 1 282 3 180 1 215 1 282 1 315 3 213 1 262 1 315 1 335 3 213 1 420 1 400 1 420 1 400 1 420 1 315 1 370 1 335 1 282 3 180 1 215 1 282 1 315 3 213 1 330 1 315 1 282 3
echo "Berlioz's extract from Sabbath Night of Symphonie Fantastique"
play 312 262 3 247 3 262 3 220 3 247 3 196 3 220 3 220 3 262 3 262 3 294 3 262 3 247 3 220 3 196 3 247 3 262 3 247 5 220 1 220 5
echo "Oldskool Batman tune"
@vovavili
vovavili / app.py
Last active May 7, 2024 13:35
Streamlit + Firebase authorization example
"""Module for handling authentication, interactions with Firebase and JWT cookies.
This solution is refactored from thestreamlit_authenticatorpackage . It leverages JSON
Web Token (JWT) cookies to maintain the users login state across browser sessions. For the
backend, It uses Googles Firebase Admin Python SDK. This solution ensures that the content
of the page and user settings panel are only displayed if the user is authenticated. Similarly,
the login page can only be accessed if the user is not authenticated. Upon registration, the
user is sent a verification link to their e-mail address.
Important - to make this app run, put the following variables in your secrets.toml file:
COOKIE_KEY - a random string key for your passwordless reauthentication
@cquangc
cquangc / app.py
Created June 30, 2023 05:26 — forked from vovavili/app.py
Streamlit + Firebase authorization example
"""Module for handling authentication, interactions with Firebase and JWT cookies.
This solution is refactored from thestreamlit_authenticatorpackage . It leverages JSON
Web Token (JWT) cookies to maintain the users login state across browser sessions. For the
backend, It uses Googles Firebase Admin Python SDK. This solution ensures that the content
of the page and user settings panel are only displayed if the user is authenticated. Similarly,
the login page can only be accessed if the user is not authenticated. Upon registration, the
user is sent a verification link to their e-mail address.
Important - to make this app run, put the following variables in your secrets.toml file:
COOKIE_KEY - a random string key for your passwordless reauthentication
@LokeshKumarES
LokeshKumarES / 3_Swapping_of_Two_Numbers_without_third_variable.c
Created August 12, 2019 05:19
Q.6 Two numbers are input through the keyboard into two locations C and D. Write a program to interchange the contents of C and D.
#include<Stdio.h>
int main()
{
int C, D, T;
printf("Enter the value of C: ");
scanf("%d", &C);
printf("Enter the value of D: ");
scanf("%d", &D);
; ----------------------------------------------------------------------------------------------------------------------
; Name ..........: TrayIcon library
; Description ...: Provide some useful functions to deal with Tray icons.
; AHK Version ...: AHK_L 1.1.13.01 x32/64 Unicode
; Original Author: Sean (http://goo.gl/dh0xIX) (http://www.autohotkey.com/forum/viewtopic.php?t=17314)
; Update Author .: Cyruz (http://ciroprincipe.info) (http://ahkscript.org/boards/viewtopic.php?f=6&t=1229)
; Mod Author ....: Fanatic Guru
; License .......: WTFPL - http://www.wtfpl.net/txt/copying/
; Version Date...: 2014 - 01 - 16
; Note ..........: Many people have updated Sean's original work including me but Cyruz's version seemed the most straight
/**
* Converts an ArrayBuffer to a String.
*
* @param buffer - Buffer to convert.
* @returns String.
*/
export default function arrayBufferToString(buffer: ArrayBuffer): string {
return String.fromCharCode.apply(null, Array.from(new Uint16Array(buffer)));
}
@h3ssan
h3ssan / JetBrains trial reset.md
Last active May 7, 2024 13:31
Reset all JetBrains products trial in Linux

In some cases, only these lines will work

for product in IntelliJIdea WebStorm DataGrip PhpStorm CLion PyCharm GoLand RubyMine; do
    rm -rf ~/.config/$product*/eval 2> /dev/null
    rm -rf ~/.config/JetBrains/$product*/eval 2> /dev/null
done

But if not, try these

@wosephjeber
wosephjeber / instructions.md
Last active May 7, 2024 13:31
Ecto migration for renaming table with indexes and constraints

Renaming table in Ecto migration

I recently wanted to rename a model and its postgres table in a Phoenix app. Renaming the table was simple and documented, but the table also had constraints, sequences, and indexes that needed to be updated in order for the Ecto model to be able to rely on default naming conventions. I couldn't find any examples of what this would look like but was eventually able to figure it out. For anyone else in the same situation, hopefully this example helps.

In the example below, I'm renaming the Permission model to Membership. This model belongs to a User and an Account, so it has foreign key constraints that need to be renamed.

defmodule MyApp.Repo.Migrations.RenamePermissionsToMemberships do
  use Ecto.Migration