This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Let's redefine rand() by simply compiling creating an position-independent object code: | |
* $ gcc -c -fPIC libmyrand.c -o libmyrand.o | |
* | |
* Then create a shared library object from it: | |
* $ gcc libmyrand.o -shared -o libmyrand.so | |
* | |
* As a last step, load this dynamic library, so the dynamic linker will link this rand(), | |
* instead of the one inside the standard library: | |
* $ export LD_PRELOAD=./libmyrand.so |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Dump current disk usage | |
df -h | |
# Remove unused containers | |
yes | docker container prune | |
# Remove unused images | |
yes | docker image prune -a | |
# Dump saved disk space | |
df -h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import http from 'k6/http'; | |
import { check, group } from 'k6'; | |
export let options = { | |
stages: [ | |
{ duration: '0.5m', target: 3 }, // simulate ramp-up of traffic from 1 to 3 virtual users over 0.5 minutes. | |
{ duration: '0.5m', target: 4}, // stay at 4 virtual users for 0.5 minutes | |
{ duration: '0.5m', target: 0 }, // ramp-down to 0 users | |
], | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require 'io/console' | |
require 'pg' | |
require 'chunky_png' | |
WIDTH = 2000 | |
HEIGHT = 2000 | |
ROWS = 10000 | |
OUTFILE = 'rplace.png' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Copy this script to your /usr/local/bin/ /usr/bin, or put its path into PATH | |
# Customize these: | |
SERVER_MAC="44:8a:xx:xx:xx:xx" | |
CLIENT_IFACE="wlp2s0" | |
SSH_PARAM="user@address" | |
# ---- | |
myhelp() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`timescale 1ns / 1ps | |
////////////////////////////////////////////////////////////////////////////////// | |
// Company: | |
// Engineer: | |
// | |
// Create Date: 2019/08/05 11:02:11 | |
// Design Name: | |
// Module Name: blinker | |
// Project Name: | |
// Target Devices: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
["function", ["hello", [], [ | |
["call", ["console", "log"], ["hello, world"]], | |
["return", []] | |
] | |
] | |
], | |
["function", ["addTwoNums", ["a", "b"], [ | |
["return", [ | |
["+", ["a", "b"]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Compile with: gcc -O2 leaf.c -o leaf | |
// Proof: https://godbolt.org/z/vg1FSS | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <ctype.h> | |
// Not actually tweaking the stack (except for ret) | |
int leaf_me_alone(int a, int b) | |
{ | |
return a*a + b*b / 2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// esversion: 6; | |
/// SETTINGS /// | |
// Maximum number of posts to be showed | |
const MAX_COUNT = 10; | |
// List of the subreddits, the desired sort order (multiple is allowed) | |
// and count of posts | |
const SUBREDDITS = [ | |
{ | |
name: 'spacex', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Mining example | |
require 'benchmark' | |
require 'openssl' | |
def hash_ok?(hash, complexity) | |
hash.start_with?("0" * complexity) | |
end | |
# Appending a nonce the the | |
def create_target(str, nonce) |
NewerOlder