Skip to content

Instantly share code, notes, and snippets.

View matdombrock's full-sized avatar
🏠
Working from home

Mathieu Dombrock matdombrock

🏠
Working from home
View GitHub Profile
@matdombrock
matdombrock / install-openocd.sh
Last active July 6, 2023 22:56
Install openocd
#!/bin/bash
#
# Downloads builds and install openocd for m1 macs
#
#install additional brew libraries
brew install libtool automake texinfo wget gcc pkg-config libusb
# some path magic so compilers know where to look for stuff

We used to use jQuery for a lot of things.

We used to use jQuery for easily selecting elements. This has never been a problem IMO but its now we also have querySelector which is just as easy as jQuery.

jQ

$('.button')

Vanilla JS

@matdombrock
matdombrock / fixURLSearchParams.js
Created February 12, 2018 03:55
URLSearchParams() does not work on mobile for iOS, this is an example of a workaround.
if ('URLSearchParams' in window) {
var urlParams = new URLSearchParams(window.location.search);
if(urlParams.has('id')){
var id = urlParams.get('id')
$.ajax({dataType: "json",url: "api.php?id="+id, success: function(result){
//ajax
}});
}
}else{
url = window.location.href;
def GenMatrix(row,col):
Matrix = [["+" for x in range(col)] for y in range(row)]
return Matrix
#world descriptions
def RenderWorld(world, world_shape):
for cur_row in range(world_shape[0]):#c
line = ""
for cur_col in range(world_shape[1]):#r
#print(Matrix[x][y])
line += str(world[cur_row][cur_col])
import numpy as np
import random
render_chars = {}
render_chars[99]="X"
render_chars[12]="^"
render_chars[11]="~"
render_chars[10]="o"
render_chars[9]="#"
render_chars[0]=" "
@matdombrock
matdombrock / reorder-lines.py
Created September 9, 2017 06:48
Python Change Order of Lines
import os
for filename in os.listdir("."):
if(filename != "re.py"):
with open(filename, "r") as infile:
lines = [line for line in infile] # Read all input lines into a list
ordering = [0,1,2,3,4,5,6,7]#change this
with open(filename, "w") as outfile:
for idx in ordering: # Write output lines in the desired order.
@matdombrock
matdombrock / Python-Arduino.md
Last active May 12, 2024 05:14
Simple Arduino Serial Monitor - Python

what's this??

A simple set of scripts for getting output from an Arduino to act is input for Python.

how to use?

  • Install python3
  • Install pyserial
  • adjust monitor.py to include your COM location as the COM variable (ie COM3 or /dev/ttyACM0)
  • run with python monitor.py --monitor (You may have to run as root on linux)

what are these numbers?

@matdombrock
matdombrock / image-rip.sh
Created April 20, 2017 08:10
download all images with wget
wget -r -l 1 -A jpg,jpeg,png,gif,bmp -H http://www.simonstalenhag.se/
@matdombrock
matdombrock / commandlineInput.php
Created July 24, 2016 00:24
Get command line input for PHP5
<?php
function input($ask = "Command"){
$answer = readline($ask.": ");
readline_add_history($answer);
return $answer;
}
echo "Welcome \n";
$name = input("What is your name?");
echo "Hello ".$name." \n";
input();
100% working onion links, all checked! Last updated July 2016.
========================================================
.::Wikis and Search Engines::.
========================================================
DuckDuckGo Search Engine: http://3g2upl4pq6kufc4m.onion/
TORCH '96 Tor Search Engine: http://xmh57jrzrnw6insl.onion/
Uncensored Hidden Wiki: http://zqktlwi4fecvo6ri.onion/wiki/index.php/Main_Page
The Hidden Wiki: http://kpvz7ki2v5agwt35.onion
TorLinks: http://torlinkbgs6aabns.onion/