Skip to content

Instantly share code, notes, and snippets.

// This will open up a prompt for text to send to a console session on digital ocean
// Useful for long passwords
(function () {
var t = prompt("Enter text to be sent to console, (This wont send the enter keystroke)").split("");
function f() {
var character = t.shift();
var i=[];
var code = character.charCodeAt();
var needs_shift = "!@#$%^&*()_+{}:\"<>?~|".indexOf(character) !== -1
#include <stdio.h>
#include <errno.h>
#include <sys/types.h>
#include <unistd.h>
#include <string.h>
#include <assert.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <sys/ioctl.h>
@croepha
croepha / django_pycharm.py
Last active July 28, 2022 13:02
This will activate an attached PyCharm or PyDev debugger on a django 500 error
# This will activate an attached PyCharm or PyDev debugger on a django 500
# error
# This makes it so that you dont have to set a breakpoint
# To use this, run the project in PyCharm or PyDev in debug mode, paste
# or import this code somewhere ( i usually just paste it in urls.py )
# inspired by these:
# https://github.com/jlubcke/pytest-pycharm/blob/master/pytest_pycharm.py
@croepha
croepha / Chapter_000_Introduction.cpp
Last active May 11, 2022 06:04
Croepha's guide to computer programming [VERY EARLY DRAFT EVERYTHING SUBJECT TO CHANGE]
/*
TODO: Need to work on language so that ESL and Children would have easier time reading
Summary Paragraph:
This is a guide for people who have little or no computer programming
experience but aspire to create excellent and high quality software.
We will cover everything to get you started, including getting your
computer ready for programming and talking about some basic concepts.
Eventually we will work our way onto making quite sophisticated programs.
@croepha
croepha / pre_chroot.sh
Last active January 15, 2022 05:36
My diskless ubuntu setup
#!/bin/sh
# Set R to chroot location
# set SERVER_IP to the ip address of the server
R=$HOME/pxe_ubuntu
# SERVER_IP="192.168.4.198"
LAN_L2="eth2"
WAN_L2="eth0"
LAN_ADDRESS=10.77.5.1
LAN_NETWORK=10.77.5.0
@croepha
croepha / main.cpp
Created December 15, 2016 18:09
Example of calling into the kernel vdso directly
#include <stdio.h>
#include <sys/auxv.h> // For getauxval and AT_SYSINFO_EHDR
#include <string.h>
#include <elf.h>
typedef unsigned char u8;
void* vdso_sym(char* name) {
// in order to semantically inline getauxval one would have to bypass glibc, as the auxval is passed
// by the kernel to the bin's entrypoint used by the kernel
@croepha
croepha / entrypoint.bash
Created February 5, 2021 22:54
sometimes you just want a bare ubuntu in a container to ssh to
v/entrypoint.bash
#!/bin/bash
#!/bin/bash
# sudo docker run "--env=SSH_KEY=$( ssh-add -L )" --name ssh1 --volume=$HOME/ssh1:/v '--entrypoint=/v/entrypoint.bash' -d ubuntu:20.04
mount -t devtmpfs none /dev
mount -t devpts none /dev/pts
exit # Dont run this as a script
# LLVM seems to work great on Musl, there only seems some build errors
# when trying to build the sanitizers. So sanitizers have been disabled.
# This is rougly based on this:
# https://wiki.musl-libc.org/building-llvm.html
# But updated for LLVM 8
# We are also focusing on making a GNU-less toolchain, as there is
# no libgcc and no libstdc++, instead we favor LLVM's own compiler-rt
// License and copyright at the bottom
/* These variations of SHA-2 are implmented:
* checksum bytes nocopy alignment in bytes nocopy chunk size in bytes
SHA256 32 4 64
SHA512 64 8 128
SHA512_256 32 8 128
*/
// There are also three APIs for each, simple, buffered, and nocopy:
char* vertex_shader =
"#version 100\n"
"attribute highp vec3 mesh_xyz;\n"
"attribute highp vec4 mesh_color;\n"
"uniform highp mat4 model_view;\n"
"uniform highp mat4 projection;\n"
"varying highp vec4 vertex_color;\n"
"varying highp vec4 vertex_position;\n"
"void main () {\n"
" vertex_color = mesh_color;\n"