This file contains hidden or 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/sh | |
| version="$1" | |
| bootdir=/boot | |
| [ -x /usr/bin/dracut ] || exit 0 | |
| # passing the kernel version is required | |
| [ -z "${version}" ] && exit 0 |
This file contains hidden or 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
| def selsort(xs): | |
| for k in range(len(xs) - 1, -1, -1): | |
| print(k) | |
| done = True | |
| imax = 0 | |
| for i in range(1, k + 1): | |
| if xs[i] > xs[imax]: | |
| imax = i | |
| else: |
This file contains hidden or 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/python | |
| from subprocess import check_output | |
| from time import sleep | |
| import click, sys | |
| def is_interface_up(iface): | |
| try: | |
| return b'state DOWN' not in check_output(["/usr/bin/ip", "link", "show", "dev", iface]) and \ | |
| b'inet' in check_output(["/usr/bin/ip", "addr", "show", "dev", iface]) |
This file contains hidden or 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
| from pykeyboard import PyKeyboard | |
| from inputs import get_gamepad | |
| import time, math | |
| import threading | |
| kbd = PyKeyboard() | |
| tmax = 0.1 | |
| tmin = 0.02 | |
| curr = 0 |
This file contains hidden or 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
| \documentclass{standalone} | |
| \usepackage{pgf,pgffor} | |
| \newcommand{\nth}[2]{ | |
| \foreach \x [count=\k] in #1 { | |
| \ifnum\k=#2 | |
| \x | |
| \fi | |
| } | |
| } |
This file contains hidden or 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 subprocess | |
| import functools | |
| import itertools | |
| import pprint | |
| def transpose(table, fillvalue=None): | |
| return itertools.zip_longest(*table, fillvalue=fillvalue) | |
| def fwf_format(table): | |
| widths = [max([len(row) for row in col]) |
This file contains hidden or 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 java.util.Random; | |
| import java.util.Arrays; | |
| class FisherYates { | |
| public static <T> void shuffle(Random random, T[] array) { | |
| shufflePartial(random, array, 1.0f); | |
| } | |
| public static <T> void shufflePartial(Random random, T[] array, double fudge) { | |
| assert(fudge >= 0.0f && fudge <= 1.0f); |
This file contains hidden or 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 sys | |
| import os, stat | |
| import fileinput | |
| def fixperm(path): | |
| mode = os.stat(path)[stat.ST_MODE] | |
| perm = mode & stat.S_IRWXU & (~stat.S_IWUSR) | |
| mode |= mode & (~stat.S_IRWXG) | (perm >> 3) | |
| mode |= mode & (~stat.S_IRWXO) | (perm >> 6) | |
| print(oct(mode), path) |
This file contains hidden or 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
| <!doctype html> | |
| <html lang="en"> | |
| <head> | |
| <title>cyberlympics</title> | |
| <meta name="generator" content="Etherpad"> | |
| <meta name="author" content="Etherpad"> | |
| <meta name="changedby" content="Etherpad"> | |
| <meta charset="utf-8"> | |
| <style> | |
| * { |
This file contains hidden or 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 requests | |
| import pprint | |
| API_BASE = 'https://www.censys.io/api/v1/{}' | |
| API_AUTH = ('API_ID', 'SECRET') | |
| def call(base, query): | |
| results = [] | |
| page_id = 1 |