Tuesday, October 4
Shadow

gist

Helper function for responsiveness in react native

gist
import { Dimensions, PixelRatio } from "react-native"; // Retrieve initial screen's width let screenWidth = Dimensions.get("window").width; // Retrieve initial screen's height let screenHeight = Dimensions.get("window").height; /** * Converts provided width percentage to independent pixel (dp). * @param {string} widthPercent The percentage of screen's width that UI element should cover * along with the percentage symbol (%). * @return {number} The calculated dp depending on current device's screen width. */ const widthPercentageToDP = (widthPercent) => { // Parse string percentage input and convert it to number. const elemWidth = typeof widthPercent === "number" ? widthPercent : parseFloat(widthPercent); // Use PixelRatio.roun...

Multiple SSH keys for different github accounts

gist
Multiple SSH Keys settings for different github account create different public key create different ssh key according the article Mac Set-Up Git $ ssh-keygen -t rsa -C "your_email@youremail.com" Please refer to github ssh issues for common problems. for example, 2 keys created at: ~/.ssh/id_rsa_activehacker ~/.ssh/id_rsa_jexchan then, add these two keys as following $ ssh-add ~/.ssh/id_rsa_activehacker $ ssh-add ~/.ssh/id_rsa_jexchan you can delete all cached keys before $ ssh-add -D finally, you can check your saved keys $ ssh-add -l Modify the ssh config $ cd ~/.ssh/ $ touch config $ subl -a config Then added #activehacker account Host github.com-activehacker HostName github.com User git IdentityFile ~/.ssh/id_rsa_activehacker #jexchan account Host github.com-jexchan...

Animate PIL

gist
# Plot fig, ax = plt.subplots(2, figsize=(15,6)) ax[0].scatter(x1, y1, s=100, linewidths=3, c= 'orange') ax[0].plot(x1, y1,'--', color = 'black') for t, txt in enumerate(l1[:-1]): ax[0].annotate(t +1, (x1[t], y1[t]), size = 10, color = 'black') ax[0].set(title = 'OR-Tool TSP Optimization Solution Route') ax[1].scatter(x2, y2, s=100, linewidths=3, c= 'yellow') ax[1].plot(x2, y2,'--', color = 'black') for t, txt in enumerate(l2[:-1]): ax[1].annotate(t +1, (x2[t], y2[t]), size = 10, color = 'black') ax[1].set(title = 'Next Closest Location Solution Route') plt.show()

rtw89 CTRL-EVENT-BEACON-LOSS workaround

gist
#!/bin/env python # journalctl -u wpa_supplicant -f -o json | python event_listener.py import json import sys import subprocess __BEACON_LOSS = 'CTRL-EVENT-BEACON-LOSS' __REASSOCIATE = ['/usr/bin/sudo', '/usr/sbin/wpa_cli', 'reassociate'] __WINDOW = 10 * 1_000_000 __THRESHOLD = 5 def main(): messages = [] for line in sys.stdin: msg = json.loads(line) print(msg['SYSLOG_TIMESTAMP'], msg['MESSAGE']) messages.insert(0, msg) if len(messages) > 100: messages.pop() t0 = int(msg['__REALTIME_TIMESTAMP']) tc = t0 - __WINDOW if __BEACON_LOSS in msg['MESSAGE']: error_count = 1 for h in messages: if __BEACON_LOSS in h['MESSAGE']: erro...

Find Variables available in one data.frame not available in another.

gist
#' Find variable that are not available in one on another data.frame #' #' @param x data.frame 1 #' @param y data.frame 2 #' #' @return #' @export #' #' @examples extra_vars <- function(x, y) { # ____________________________________________________________________________ # on.exit #### on.exit({ }) # ____________________________________________________________________________ # Defenses #### stopifnot( exprs = { is.data.frame(x) is.data.frame(y) } ) # ____________________________________________________________________________ # Early returns #### if (FALSE)...

Solution to level 2 in Untrusted

gist
/******************** * theLongWayOut.js * ******************** * * Well, it looks like they're on to us. The path isn't as * clear as I thought it'd be. But no matter - four clever * characters should be enough to erase all their tricks. */ function startLevel(map) { map.placePlayer(7, 5); var maze = new ROT.Map.DividedMaze(map.getWidth(), map.getHeight()); maze.create( function (x, y, mapValue) { // don't write maze over player if (map.getPlayer().atLocation(x,y)) { return 0; } else if (mapValue === 1) { //0 is empty space 1 is wall map.placeObject(x,y, 'block'); } else { map.placeObject(x,y,'empty'); } }); map.placeObject(map.getWidth()-4, map.getHeight()-4, 'b...

zabbix-agent.install v4.0.43 – Passed – Package Tests Results

gist
<?xml version="1.0" encoding="utf-8"?> <registrySnapshot xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <user>S-1-5-21-1953236517-242735908-2433092285-500</user> <keys> <key installerType="Msi" displayName="Zabbix Agent (64-bit)" displayVersion="4.0.43.2400"> <RegistryView>Registry64</RegistryView> <KeyPath>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{C88ACF58-5070-4369-9416-976AE468C198}</KeyPath> <DefaultValue /> <InstallLocation><![CDATA[C:\Program Files\Zabbix Agent\]]></InstallLocation> <UninstallString><![CDATA[MsiExec.exe /I{C88ACF58-5070-4369-9416-976AE468C198}]]></UninstallString> <HasQuie...

clash-for-windows v0.19.27 – Passed – Package Tests Results

gist
<?xml version="1.0" encoding="utf-8"?> <registrySnapshot xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <user>S-1-5-21-1953236517-242735908-2433092285-500</user> <keys> <key installerType="Custom" displayName="Clash for Windows 0.19.27" displayVersion="0.19.27"> <RegistryView>Registry64</RegistryView> <KeyPath>HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\af61d581-bfa6-515e-bf22-56b60d25a5b3</KeyPath> <DefaultValue /> <InstallLocation><![CDATA[]]></InstallLocation> <UninstallString><![CDATA["C:\Users\Administrator\AppData\Local\Programs\Clash for Windows\Uninstall Clash for Windows.exe" /currentuser /S]]></Uni...

Plutus Playground Smart Contract

gist
[0,[{"simulationWallets":[{"simulatorWalletWallet":{"getWallet":1},"simulatorWalletBalance":{"getValue":[[{"unCurrencySymbol":""},[[{"unTokenName":""},100000000]]]]}},{"simulatorWalletWallet":{"getWallet":2},"simulatorWalletBalance":{"getValue":[[{"unCurrencySymbol":""},[[{"unTokenName":""},100000000]]]]}}],"simulationName":"Simulation 1","simulationId":1,"simulationActions":[{"tag":"CallEndpoint","caller":{"getWallet":1},"argumentValues":{"endpointDescription":{"getEndpointDescription":"publish"},"argument":{"contents":[{"contents":2,"tag":"FormIntegerF"},{"contents":{"getValue":[[{"unCurrencySymbol":""},[[{"unTokenName":""},10000000]]]]},"tag":"FormValueF"}],"tag":"FormTupleF"}}},{"tag":"AddBlocks","blocks":1},{"tag":"C...

DXVK optimizate for wow 3.3.5a HD Version [warmane]

gist
#UPDATED: 2022-AGO-20 #IMPORTANT NOTE: PLEASE DONT TEST PERFOMANCE IN DALARAN, IS A HOLY ***** BAD OPTMIZAED #IMPORTANT NOTE 2: In game settings, could be in ultra, but some options should be low, because are bad optmized, test by yourself dxgi.nvapiHack = False # you can test, change it to TRUE. According if you have AMD or NVIDIA gpu dxgi.maxFrameRate = 75 d3d9.maxFrameRate = 75 dxvk.hud = devinfo,fps,pipelines # REMOVE THIS LINE FOR HIDE FPS HUD dxgi.maxFrameLatency = 1 d3d9.maxFrameLatency = 1 dxgi.numBackBuffers = 0 # // I GET MORE FPS IN 0 d3d9.numBackBuffers = 0 # // I GET MORE FPS IN 0 d3d9.presentInterval = 0 # Disable Vsync in 0 dxgi.syncInterval = 0 # Disable Vsync in 0 dxgi.tearFree = Auto # // I GET MORE FPS IN False d3d9.tearFree = Auto # Vsync replace fuction // I GET MOR...