Skip to content

Instantly share code, notes, and snippets.

@Daan-Grashoff
Daan-Grashoff / google_search_maps_addon.js
Last active May 23, 2024 04:31
Bring back the google maps button when searching on google
// ==UserScript==
// @name Google maps addon
// @namespace http://tampermonkey.net/
// @version 2024-03-21
// @description Bring google maps button back
// @author You
// @match https://www.google.com/search*
// @include https://www.google.tld/search*
// @icon https://www.google.com/images/branding/googleg/1x/googleg_standard_color_128dp.png
// @grant none
@a7madgamal
a7madgamal / dark.md
Last active July 14, 2023 04:00
Dark mode for Slack on MacOS
@dingran
dingran / dijkstra.py
Last active November 30, 2023 22:43
Python implementation of Dijkstra's algorithm, single source all desinations and single source single destination
from collections import defaultdict
def build_graph(edge_list):
graph = defaultdict(list)
seen_edges = defaultdict(int)
for src, dst, weight in edge_list:
seen_edges[(src, dst, weight)] += 1
if seen_edges[(src, dst, weight)] > 1: # checking for duplicated edge entries
continue
@hanfang
hanfang / shortestPath.py
Last active November 11, 2023 22:09
Finding the shortest path in a weighted DAG with Dijkstra in Python and heapq
import collections
import heapq
def shortestPath(edges, source, sink):
# create a weighted DAG - {node:[(cost,neighbour), ...]}
graph = collections.defaultdict(list)
for l, r, c in edges:
graph[l].append((c,r))
# create a priority queue and hash set to store visited nodes
queue, visited = [(0, source, [])], set()
@Overdrivr
Overdrivr / coords-ligne3-metro-toulouse.json
Created October 31, 2016 11:32
Coordonnées GPS estimées de la ligne 3 du métro de Toulouse (parcours validé a ce jour, il manque les parcours optionnels). Voir la carte
[
{name: 'Airbus Colommiers', coords: [43.6164113,1.3505030]},
{name: 'Airbus Saint Martin', coords: [43.6119056,1.3726646]},
{name: 'Jean Maga', coords: [43.6217381,1.3969560]},
{name: 'Espace Job', coords: [43.6164200,1.4076825]},
{name: 'Boulevard de suisse', coords: [43.6170028,1.4220444]},
{name: 'Fondeyre (estimation)', coords: [43.6294087,1.4294307]},
{name: 'La Vache SNCF', coords: [43.6346464,1.4398956]},
{name: 'Toulouse Lautrec (estimation)', coords: [43.6270672,1.4443802]},
{name: 'Raynal', coords: [43.6168462,1.4508390]},
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active May 23, 2024 23:26
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@ogrrd
ogrrd / dnsmasq OS X.md
Last active May 14, 2024 08:39
Setup dnsmasq on OS X

Never touch your local /etc/hosts file in OS X again

To setup your computer to work with *.test domains, e.g. project.test, awesome.test and so on, without having to add to your hosts file each time.

Requirements

Install

@pjdietz
pjdietz / Virtual Box Host Only Static IP.md
Created June 12, 2013 19:01
VirtualBox Host-Only Adapter with Static IP

VirtualBox Host-Only Static IP

My typical setup for a development box in VirtualBox uses two NICs. The first uses NAT to allow the box to communicate with the outside world through my host computer’s network connection. (NAT is the default, so shouldn't require any setup.) The second is a "host-only" connection that allows my host and guest to interact.

To create a host-only connection in VirtualBox, start by opening the preferences in VirtualBox. Go to the "Network" tab, and addd a Host-only Network. Modify the host-only network, and disable DHCP. Make a note of the IP address. (Feel free to set the IP address as well, if you like.)

Next, assign this host-only adapter to the virtual machine. Select the VM and press "Settings". Go to the "Network" tab, and select "Adpater 2". Enable the adapter, set it to a "Host-only Adapter", and select the adpater you created above.

Temporary

@yosemitebandit
yosemitebandit / meduele_login_with_requests.py
Created February 12, 2012 02:46
using the request lib's sessions to login; bonus: beautiful soup finds the csrf token
#!/usr/bin/env python
'''
testing a login to meduele using sessions
meduele checks csrf tokens with every request, even during login
'''
import requests
from BeautifulSoup import BeautifulSoup
# need to capture a valid csrf token
# first visit the login page to generate one