Skip to content

Instantly share code, notes, and snippets.

@maligree
maligree / clamonaccess.md
Last active July 11, 2023 11:50
clamonaccess (ClamAV on-access scanning) setup for Ubuntu 20.04 LTS

You need clamav installed and running.

apt install clamav

Verify with:

systemctl status clamav-daemon | grep Active

Since we moved today’s KS because of low attendance + the fact that it will take 2-3 separate KS meetings to fully cover the topic and a long weekend between them would suck (there’s some context to it), I’ve compiled my slides and other notes to give you something to check out if you’re extra bored/interested in the subject.

These are just bullet points, all of them (and more) will be expanded during the actual KS sessions after the weekend.

  • the notion of performance critical code should come up as early as first code review, but let’s not optimize prematurely
  • I spent a lot of time rewriting parts of Rye to first C++, then dropped the experiment for a few weeks because of TrustedMail work
  • I did a golang implementation as well (actually, I initially did it out of boredom on a weekend and wasn’t even expecting to finish it — but it turned out so pleasant that I did).
  • go has nice built-in benchmarking support, allows you to turn a regular test into a benchmark, which is NICE.
  • I won’t go into

Keybase proof

I hereby claim:

  • I am maligree on github.
  • I am maligree (https://keybase.io/maligree) on keybase.
  • I have a public key ASDPOpmi0yexyEwOrD4SNi8wsWvhWo-KkHgbyHYHWcW1VAo

To claim this, I am signing this object:

MY_OLD_PWD=""
MY_ALIASES=""
function load_aliases() {
if [ "${PWD}" != "${MY_OLD_PWD}" ]; then
echo "PWD differs"
MY_OLD_PWD="${PWD}"
for NAME in ${MY_ALIASES}; do
unalias "${NAME}"
@maligree
maligree / gist:6448505
Created September 5, 2013 10:33
kod z multiprocessing
def cpu_count():
'''
Returns the number of CPUs in the system
'''
if sys.platform == 'win32':
try:
num = int(os.environ['NUMBER_OF_PROCESSORS'])
except (ValueError, KeyError):
num = 0
elif 'bsd' in sys.platform or sys.platform == 'darwin':
ps aux | grep python
kill <wszystko co z pythonem>
cd portal-sql
source venv/bin/activate
nohup python manage.py runserver 0.0.0.0:9876 &
@maligree
maligree / gist:6113756
Created July 30, 2013 15:03
How it happened.
# open up the DB in the console
$ sqlite3 storage/regroup.db
# set output mode to `insert`, this returns SQL
sqlite3> .mode insert
# set output to file
sqlite3> .out /home/jacek/apps.sql
# run the query, effectively creating an SQL dump of the data
sqlite3> select * from apps;
# change output file (required, see sed lines)
sqlite3> .out /home/jacek/resources.sql
@maligree
maligree / gist:5998561
Created July 15, 2013 09:10
Dumb stress testing insights:
**************** 15/20, Shotgun ****************
~ » python stress.py maligree@WickedArtistry
[#] Firing up.
[*] Will do 15 simultaneous, 20-request series.
--- HTTP 200, took 7.23 s
--- HTTP 200, took 7.23 s
--- HTTP 200, took 7.24 s
--- HTTP 200, took 7.21 s
--- HTTP 200, took 7.26 s
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
// init the FB JS SDK
FB.init({
appId : 'YOUR_APP_ID', // App ID from the app dashboard
channelUrl : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel file for x-domain comms
status : true, // Check Facebook Login status
xfbml : true // Look for social plugins on the page
});
@maligree
maligree / sigit.php
Created April 23, 2013 14:51
A down-to-earth reference implementation of the wicked OAuth signing process. Without a token secret.
<?php
/*
* No-frills OAuth 1.0 request signing code.
* For reference see:
* https://dev.twitter.com/docs/auth/creating-signature
*/
function get_sig($uri, $c_key, $c_secret) {