Skip to content

Instantly share code, notes, and snippets.

@recluze
recluze / ctf-dec.py
Created December 7, 2022 05:52
CTF for CyberHub and Programming Club (2022-12)
## Capture the Flag - Cypto Beginners - Basic Cypher
# authors: Nauman (recluze) / Sohail
# Effat University, Jeddah, KSA
# Information availble to perform cryptanalysis:
# - Message is in the English language
# - Message is approximately (but not exactly) 10 words long
@recluze
recluze / fib.exs
Created August 18, 2018 16:05 — forked from kyanny/fib.exs
Elixir fibonacci #1
defmodule Fib do
def fib(0) do 0 end
def fib(1) do 1 end
def fib(n) do fib(n-1) + fib(n-2) end
end
IO.puts Fib.fib(10)
@recluze
recluze / main.dart
Created June 28, 2018 16:08
Dart Tes
printNumber(int num) {
print("The number is: ${num}!!");
}
void main() {
for (int i = 0; i < 5; i++) {
print('hello ${i + 1}');
}
@recluze
recluze / asterisk-installation-steps
Created June 25, 2018 12:40
asterisk-installation
First, update and upgrade all packages:
sudo apt-get update
sudo apt-get upgrade
sudo -i # Change to root
cd /usr/local/src
Main docs:
https://wiki.asterisk.org/wiki/display/AST/Installing+Asterisk+From+Source
@recluze
recluze / beautiful_idiomatic_python.md
Created November 4, 2017 13:59 — forked from JeffPaine/beautiful_idiomatic_python.md
Transforming Code into Beautiful, Idiomatic Python: notes from Raymond Hettinger's talk at pycon US 2013. The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Transforming Code into Beautiful, Idiomatic Python

Notes from Raymond Hettinger's talk at pycon US 2013 video, slides.

The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Looping over a range of numbers

for i in [0, 1, 2, 3, 4, 5]:
# searchAgents.py
# ---------------
# Licensing Information: You are free to use or extend these projects for
# educational purposes provided that (1) you do not distribute or publish
# solutions, (2) you retain this notice, and (3) you provide clear
# attribution to UC Berkeley, including a link to http://ai.berkeley.edu.
#
# Attribution Information: The Pacman AI projects were developed at UC Berkeley.
# The core projects and autograders were primarily created by John DeNero
# (denero@cs.berkeley.edu) and Dan Klein (klein@cs.berkeley.edu).
# multiAgents.py
# --------------
# Licensing Information: You are free to use or extend these projects for
# educational purposes provided that (1) you do not distribute or publish
# solutions, (2) you retain this notice, and (3) you provide clear
# attribution to UC Berkeley, including a link to http://ai.berkeley.edu.
#
# Attribution Information: The Pacman AI projects were developed at UC Berkeley.
# The core projects and autograders were primarily created by John DeNero
# (denero@cs.berkeley.edu) and Dan Klein (klein@cs.berkeley.edu).
# multiAgents.py
# --------------
# Licensing Information: You are free to use or extend these projects for
# educational purposes provided that (1) you do not distribute or publish
# solutions, (2) you retain this notice, and (3) you provide clear
# attribution to UC Berkeley, including a link to http://ai.berkeley.edu.
#
# Attribution Information: The Pacman AI projects were developed at UC Berkeley.
# The core projects and autograders were primarily created by John DeNero
# (denero@cs.berkeley.edu) and Dan Klein (klein@cs.berkeley.edu).
model = Model()
with model:
beta = Uniform('beta', lower=-10, upper=10, shape=(1, n_predictors))
p = tinvlogit(sum(beta * predictors, 1))
Y_obs = Bernoulli('Y_obs', p=p, observed=Y)
start = find_MAP()
step = NUTS(scaling=start)
trace = sample(mcmc_training_sample_size, step, start)