// https://www.hackerrank.com/challenges/missing-numbers/problem
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
❯ rm out.csv | |
❯ cat 1.py | |
from glob import glob | |
import mmap | |
files = glob("data/*") | |
files.sort(key=lambda x: int(x.split("/")[-1].split(".")[0])) | |
write_f = open("out.csv", "w+b") |
Name | Package Id | Version | Source |
---|---|---|---|
7Zip | 7zip.7zip | 19.0.0 | winget |
Altap Salamander | salamander | choco | |
Alt-Tab Terminator | alt-tab-terminator | choco | |
AutoHotkey | Lexikos.AutoHotkey | 1.1.33.02 | winget |
AutoHotkey Store Edition | HaukeGtze.AutoHotkeypoweredbyweatherlights.com | Latest | msstore (via winget) |
Carnac |
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 random | |
import logging | |
log = logging.getLogger(__name__) | |
MAX_NUM_PRISONERS = 12 | |
NUM_PRISONERS = random.randrange(2, MAX_NUM_PRISONERS + 1) | |
def main(): | |
print(f'Number of prisoners: {NUM_PRISONERS}') |
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
########################################################### | |
# How to NEVER use lambdas. An inneficient and yet educa- # | |
# tonal [sic] guide to the proper misuse of the lambda # | |
# construct in Python 3.x. [DO NOT USE ANY OF THIS EVER] # | |
# original by (and apologies to): e000 (13/6/11) # | |
# now in Python 3 courtesy of: khuxkm (17/9/20) # | |
########################################################### | |
## Part 1. Basic LAMBDA Introduction ## | |
# If you're reading this, you've probably already read e000's |
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 re | |
import argparse | |
def deobfuscate(input_str): | |
regex_str = r"[\(\{]\s*\"(?P<format>[^\)]*?)\"\s*\-f\s*(?P<params>.*?)[\)\}]" | |
regex = re.compile(regex_str, re.MULTILINE | re.IGNORECASE) | |
for match in reversed(list(regex.finditer(input_str))): | |
format_str = match.group('format') |
Hi all. After wanting true color support in Mosh (to use Brow.sh), I also wanted to integrate it more tightly with Windows. Since I reckon more people will be wanting to accomplish this, here is a guide.
- Install Linux Subsystem for Windows if you haven't already (https://docs.microsoft.com/en-us/windows/wsl/install-win10) (I use Ubuntu)
- Make sure you can execute
bash
from a CMD prompt. - Go into the bash environment by executing
bash ~
in CMD prompt - Install Mosh-dev (for up-to-date version) from https://launchpad.net/~keithw/+archive/ubuntu/mosh-dev by doing
sudo add-apt-repository ppa:keithw/mosh-dev
thensudo apt-get update
- Create a new mosh.bat file on your Desktop with the following contents
@echo off
I was curious how to view sessions on a Linux box I had at my desk. Similar to the session table on an Aruba controller (show loginsessions
). Here are some ways you can list active SSH sessions; some commands return more output than others. This applies to most modern Linux boxes or say a WLAN Pi.
All examples below are using 2 MobaXterm user sessions from a Windows machine to a Linux 4.14.42-sunxi64 aarch64 (NanoPi NEO2).
wlanpi@wlanpi:~$ w
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
/* | |
(c) by Thomas Konings | |
Random Name Generator for Javascript | |
*/ | |
function capFirst(string) { | |
return string.charAt(0).toUpperCase() + string.slice(1); | |
} | |
function getRandomInt(min, max) { |
NewerOlder