Skip to content

Instantly share code, notes, and snippets.

View wasi0013's full-sized avatar
💤

Wasi wasi0013

💤
View GitHub Profile
@moyix
moyix / killbutmakeitlooklikeanaccident.sh
Created February 5, 2022 22:51
Script to inject an exit(0) syscall into a running process. NB: only x86_64 for now!
#!/bin/bash
gdb -p "$1" -batch -ex 'set {short}$rip = 0x050f' -ex 'set $rax=231' -ex 'set $rdi=0' -ex 'cont'
defmodule Day3 do
# Since my last answer wasn't purely Nx, I'm going
# to try to stick to Nx as much as is possible, but
# we don't have string manipulation stuff so that will
# have to be done in Elixir
import Nx.Defn
def part1 do
File.read!("aoc/3.txt")
|> parse_input()
@nsmgr8
nsmgr8 / fb_quiz_unlock_digits.py
Last active April 14, 2020 08:51
Quiz from facebook python BD group
from typing import NamedTuple, Callable
class KeyCombination(NamedTuple):
first: int
second: int
third: int
def __str__(self):
return f'{self.first}{self.second}{self.third}'
@bradtraversy
bradtraversy / docker-help.md
Last active April 15, 2024 02:31
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

@cijagani
cijagani / gist:bf2be487a9eaa7227aee45cfeef4dcaa
Created February 4, 2018 07:24
sublime-3 remove unnecessary blank-lines and white spaces
A better way to find all empty lines (including ones with whitespace) would be: ^[\s]*?[\n\r]+
@gear11
gear11 / main.py
Created December 17, 2013 14:54
Simple Python proxy server based on Flask and Requests. See: http:/python-proxy-server/gear11.com/2013/12/python-proxy-server/
"""
A simple proxy server. Usage:
http://hostname:port/p/(URL to be proxied, minus protocol)
For example:
http://localhost:8080/p/www.google.com
"""
@cyberdelia
cyberdelia / mixin.py
Created September 21, 2011 08:26
Django class based view mixins
# -*- coding: utf-8 -*-
from django.contrib.auth.decorators import login_required
from django.utils.cache import patch_response_headers
from django.utils.decorators import method_decorator
from django.views.decorators.cache import cache_page, never_cache
from django.views.decorators.csrf import csrf_exempt
class NeverCacheMixin(object):
@method_decorator(never_cache)