Skip to content

Instantly share code, notes, and snippets.

@ityonemo
ityonemo / test.md
Last active July 15, 2024 05:20
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)

@fdns
fdns / version.py
Last active February 9, 2021 20:47
Version extraction for OpenedX
#!/usr/bin/env python3
# Run me with sudo ./version.py > result
import csv
import sys
import os
import re
class VersionAnalyzer:
def __init__(self):
self.out = csv.writer(sys.stdout)
@bradtraversy
bradtraversy / python_mysql.py
Last active August 5, 2023 12:47
Python & MySQL crash course for beginners
import mysql.connector
from mysql.connector import errorcode
config = {
'user': 'root',
'password': '',
'host': 'localhost',
'database': 'acme'
}
Rank Type Prefix/Suffix Length
1 Prefix my+ 2
2 Suffix +online 6
3 Prefix the+ 3
4 Suffix +web 3
5 Suffix +media 5
6 Prefix web+ 3
7 Suffix +world 5
8 Suffix +net 3
9 Prefix go+ 2
@bwurst
bwurst / bbb-status.py
Created April 24, 2020 05:31
Simple python script to show current usage of big blue button from root@localhost
#!/usr/bin/python3
import sys
import subprocess
import re
import hashlib
import requests
from xml.etree import ElementTree
###
@mmaridev
mmaridev / bbb_zbx.py
Created April 6, 2020 13:46
BigBlueButton monitoring via Python 3 script
#!/usr/bin/python3
# Copyright (c) 2020 Marco Marinello <mmarinello@fuss.bz.it>
import sys, requests
from xml.etree.ElementTree import fromstring, ElementTree
SERVER = sys.argv[1]
SUM = sys.argv[2]
QUERY = sys.argv[3]
<?php
//php gd-gif.php image.gif gd-image.gif
$gif = imagecreatefromgif($argv[1]);
imagegif($gif, $argv[2]);
imagedestroy($gif);
?>
@stettix
stettix / things-i-believe.md
Last active July 10, 2024 23:00
Things I believe

Things I believe

This is a collection of the things I believe about software development. I have worked for years building backend and data processing systems, so read the below within that context.

Agree? Disagree? Feel free to let me know at @JanStette. See also my blog at www.janvsmachine.net.

Fundamentals

Keep it simple, stupid. You ain't gonna need it.

@harrietty
harrietty / RAILS_5_CHEATSHEET.md
Last active August 13, 2023 00:36 — forked from mdang/RAILS_CHEATSHEET.md
Ruby on Rails 5 Cheatsheet

Ruby on Rails Cheatsheet (5.1)

Architecture

RVM

$ rvm list - show currently installed Rubies

@woprrr
woprrr / example.php
Created October 4, 2017 07:40
Drupal 8 Dynamic field cardinality
$field_updated = &$form['YOUR_FIELD_NAME'];
$field_state = \Drupal\Core\Field\WidgetBase::getWidgetState($form['#parents'], $field_updated['widget']['#field_name'], $form_state);
// You can change number of item to control the number of items we can change it with another field value into $form_state.
if ($field_state['items_count'] >= 2) {
$field_updated['widget']['add_more']['#access'] = FALSE;
}
$form['YOUR_FIELD_NAME'] = $field_updated;