Skip to content

Instantly share code, notes, and snippets.

@grizmio
grizmio / gist:e36b969af8c83971bd9961b066ec10cd
Created August 4, 2022 13:03
gunicorn and cpu, resources
https://rachelbythebay.com/w/2020/03/07/costly/
https://blog.clubhouse.com/reining-in-the-thundering-herd-with-django-and-gunicorn/
@grizmio
grizmio / strace the shit
Created August 4, 2022 00:59
strace gunicorn or anything
sudo strace -s 4096 -f $( ps ax |grep gunicorn|grep -v grep|cut -d'?' -f1|while read p; do echo "-p $p" ; done|tr '\n' ' ' )
@grizmio
grizmio / client.js
Created July 22, 2022 23:02 — forked from PierBover/client.js
Node.js UDP Broadcast example
const dgram = require('dgram');
const message = new Buffer('Server?');
const socket = dgram.createSocket('udp4');
socket.on('listening', function () {
socket.setBroadcast(true);
setInterval(() => {
socket.send(message, 0, message.length, 5555, '255.255.255.255');
}, 5000);
});
@grizmio
grizmio / awk all except n-th column
Created July 14, 2022 19:24
awk all except n-th column
$ history |grep docker|awk -F' ' '{ for (i=2;i<NF;i++) printf " " $i; print " "$NF }'|grep -v history
@grizmio
grizmio / oh-my-zsh zsh slow
Created July 13, 2022 16:11
oh-my-zsh zsh git status slow
$ git config --global --add oh-my-zsh.hide-dirty 1
awk -F' ' '{ print $(NF - 1)}'
@grizmio
grizmio / gist:51f7d43a22909b745d33c1c6db5c7e86
Created March 22, 2022 16:58
CAPACITOR_ANDROID_STUDIO_PATH and android studio flatpak
mcedit ~/.zshrc
export CAPACITOR_ANDROID_STUDIO_PATH='/var/lib/flatpak/app/com.google.AndroidStudio/current/active/files/extra/android-studio/bin/studio.sh'
@grizmio
grizmio / ifnull.php
Created February 17, 2022 22:09
mariadb/mysql ifnull and cakephp
<?php
$q->where(function (QueryExpression $exp, Query $q) {
return $q->func()->ifnull(["Foo.type NOT IN ('Bar', 'Baz')" => 'identifier', 'true' => 'identifier']);
});
?>
@grizmio
grizmio / dontuseme.sh
Created December 21, 2021 00:24
Please, never, ever, use me
#!/bin/bash
export SSH_AUTH_SOCK=$HOME/.ssh/ssh-agent.$(hostname).sock
env |grep -q "^DISPLAY="
if [ $? -ne 0 ] ; then
export DISPLAY=:0
fi
pidof ssh-agent >/dev/null 2>&1
DONTSTOREMEHERE="PECO"
if [ $? -ne 0 ]; then
@grizmio
grizmio / update_codium.sh
Created November 25, 2021 15:05
One liner to update codium on ubuntu and debian
curl -L $(curl -Ls https://api.github.com/repos/VSCodium/vscodium/releases/latest | jq -c '.assets|map(select(.browser_download_url | contains("_amd64.deb")))|.[0].browser_download_url'|tr -d '"') --output /tmp/codium.deb && sudo dpkg -i /tmp/codium.deb