Skip to content

Instantly share code, notes, and snippets.

@karolzlot
karolzlot / tqdm_cpu_ram.py
Last active May 7, 2024 08:56
Monitoring real time cpu and ram usage with tqdm. If you like it please upvote this answer: https://stackoverflow.com/a/69511430/8896457
from tqdm import tqdm
from time import sleep
import psutil
with tqdm(total=100, desc='cpu%', position=1) as cpubar, tqdm(total=100, desc='ram%', position=0) as rambar:
while True:
rambar.n=psutil.virtual_memory().percent
cpubar.n=psutil.cpu_percent()
rambar.refresh()
cpubar.refresh()
@rjescobar
rjescobar / extend-trial-jetbrains-windows.bat
Created August 31, 2021 02:53
JetBrains IDE trial reset windows
REM Delete eval folder with licence key and options.xml which contains a reference to it
for %%I in ("WebStorm", "IntelliJ", "CLion", "Rider", "GoLand", "PhpStorm", "Resharper", "PyCharm") do (
for /d %%a in ("%USERPROFILE%\.%%I*") do (
rd /s /q "%%a/config/eval"
del /q "%%a\config\options\other.xml"
)
)
REM Delete registry key and jetbrains folder (not sure if needet but however)
rmdir /s /q "%APPDATA%\JetBrains"
@jruedaq
jruedaq / IntelIJTrialReset.bat
Last active May 7, 2024 08:56
How to Reset InteIIiJ IDEA Evaluation Key in Windows
cd "C:%HOMEPATH%\.IntelliJIdea*\config"
rmdir "eval" /s /q
del "options\options.xml"
reg delete "HKEY_CURRENT_USER\Software\JavaSoft\Prefs\jetbrains\idea" /f
echo "Restore completed"
pause
:: It is Highly Advised to Purchase the JetBrain Softwares
:: This is only for the case You just want to Extend the
:: Trial Period and Evaluate the IDE for some more Time
@sindresorhus
sindresorhus / esm-package.md
Last active May 7, 2024 08:55
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@ftclausen
ftclausen / Jenkinsfile
Created April 13, 2017 05:36
Jenkins pipeline - An approach to get all commits since the last successful build.
// -*- mode: groovy -*-
// vim: set filetype=groovy :
node( 'some_node' ) {
stage( "Phase 1" ) {
sshagent( credentials: [ 'some_creds' ] ) {
checkout scm
def lastSuccessfulCommit = getLastSuccessfulCommit()
def currentCommit = commitHashForBuild( currentBuild.rawBuild )
if (lastSuccessfulCommit) {
@aiexz
aiexz / api.txt
Last active May 7, 2024 08:52
Shodan API keys
OefcMxcunkm72Po71vVtX8zUN57vQtAC
PSKINdQe1GyxGgecYz2191H2JoS9qvgD
pHHlgpFt8Ka3Stb5UlTxcaEwciOeF2QM
61TvA2dNwxNxmWziZxKzR5aO9tFD00Nj
xTbXXOSBr0R65OcClImSwzadExoXU4tc
EJV3A4Mka2wPs7P8VBCO6xcpRe27iNJu
mEuInz8UH1ixLGJq4oQhEiJORERVG5xc
lkY0ng0XMo29zEhzyw3ibQfeEBxghwPF
syeCnFndQ8TE4qAGvhm9nZLBZOBgoLKd
7TeyFZ8oyLulHwYUOcSPzZ5w3cLYib61
@Dounm
Dounm / monitor_ib_traffic.py
Last active May 7, 2024 08:52
Monitor Infiniband traffic and caculate bandwidth
# Inspired by https://github.com/vpenso/ganglia-sensors/blob/master/lib/python_modules/infiniband.py#/
import logging
import re
import sys
import json
import time
import subprocess
@dblalock
dblalock / align.c
Created August 30, 2017 22:11
C / C++ portable aligned memory allocation
/* Allocate aligned memory in a portable way.
*
* Memory allocated with aligned alloc *MUST* be freed using aligned_free.
*
* @param alignment The number of bytes to which memory must be aligned. This
* value *must* be <= 255.
* @param bytes The number of bytes to allocate.
* @param zero If true, the returned memory will be zeroed. If false, the
* contents of the returned memory are undefined.
* @returns A pointer to `size` bytes of memory, aligned to an `alignment`-byte
@Kaundur
Kaundur / canvasDownload.js
Created June 8, 2017 07:25
JS to automatically download canvas as a png
// This code will automatically save the current canvas as a .png file.
// Its useful as it can be placed in a loop to grab multiple canvas frames, I use it to create thumbnail gifs for my blog
// Only seems to work with Chrome
// Get the canvas
var canvas = document.getElementById("canvas");
// Convert the canvas to data
var image = canvas.toDataURL();
// Create a link
var aDownloadLink = document.createElement('a');
@ScottJWalter
ScottJWalter / .asoundrc
Last active May 7, 2024 08:47
Jabra 410/510 on Picroft (Mycroft on Raspberry Pi)
pcm.jabra {
type hw
card 1
device 0
rate 48000
}
pcm.!sysdefault {
type asym
playback.pcm {
type plug