Skip to main content

Posts

Showing posts from May, 2021

install surfer 3d plotting software

 https://www.imaginary.org/program/surfer#all-downloads for windows simply download and install exe for linux download deb/rpm file install it manually if distro is not debian or rpm based :: 1.extract surferxx.deb using xarchiver/ark or whatever 2. move contes of  data.tar.xz to /opt or ~/opt 3. run postinst command  found in control.tar.xz in this case simply: edit SURFER.desktop to installed path to put in application menu or dmenu        cp /opt/SURFER/SURFER.desktop /usr/share/applications/     if you have matplotlib or anaconda u can plot anything using it :: example  # Import libraries from mpl_toolkits import mplot3d import numpy as np import matplotlib.pyplot as plt # Creating dataset x = np.outer(np.linspace(- 3 , 3 , 32 ), np.ones( 32 )) y = x.copy().T # transpose z = (np.sin(x ** 2 ) + np.cos(y ** 2 ) ) # Creating figyre fig = plt.figure( figsize =( 14 , 9 )) ax = plt.axes( projection = '3d' ) # Creating plot ax.plot_surface(x, y, z) # show plot plt.show()

time date format linux shell

  Date Format Option Meaning Example Output date +%c locale’s date time Sat May 9 11:49:47 2020 date +%x locale’s date 05/09/20 date +%X locale’s time 11:49:47 date +%A locale’s full weekday name Saturday date +%B locale’s full month name May date +%m-%d-%Y MM-DD-YYYY date format 05-09-2020 date +%D MM/DD/YY date format 05/09/20 date +%F YYYY-MM-DD date format 2020-05-09 date +%T HH:MM:SS time format 11:44:15 date +%u Day of Week 6 date +%U Week of Year with Sunday as first day of week 18 date +%V ISO Week of Year with Monday as first day of week 19 date +%j Day of Year 130 date +%Z Timezone PDT date +%m Month of year (MM) 05 date +%d Day of Month (DD) 09 date +%Y Year (YY) 2020 date +%H Hour (HH) 11 date +%H Hour (HH) in 24-hour clock format 11 date +%I Hour in 12-hour clock format 11 date +%p locale’s equivalent of AM or PM AM date +%P same as %p but in lower case am

turn ur pc into music streaming client

 sudo pacman -S mpc mpd mkdir ~/.config/mpd cp /usr/share/doc/mpd/mpdconf.example ~/.config/mpd/mpd.conf or make own config music_directory "~/Music" playlist_directory "~/.config/mpd/playlists" db_file "~/.config/mpd/database" log_file "~/.config/mpd/log" auto_update "yes" sticker_file "~/.config/mpd/sticker.sql" #bind_to_address "0.0.0.0" #bind_to_address "~/.config/mpd/socket" pid_file "~/.config/mpd/pid" state_file "~/.config/state" #password "cgj2m" audio_output { type "pulse" name "pulse audio" } audio_output { type "httpd" name "My HTTP Stream" encoder "vorbis" # optional, vorbis or lame port "8000" quality "5.0" # do not define if bitrate is defined # bitrate "128" # do not define if quality is defined format

polybar fix

 [module/xbacklight] type = internal/backlight card = intel_backlight   [module/wlan] label-connected = %{A1:nm-connection-editor:}%essid%%downspeed:9%%{A} or  label-connected =  %{A1:exec termite -e nmtui:}%essid% %downspeed:9%%{A}   [module/pulseaudio] click-right = pavucontrol src https://github.com/polybar/polybar/wiki/Configuration

c disassembly linux

 filename::text.c   #include <stdio.h> int main (){ printf ( "hello world" ); }   >> gcc test.c -o test && test hello world [Done] exited with code=0 in 0.044 seconds   decompile this test binary: objdump  -d test   test: file format elf64-x86-64 Disassembly of section .init: 0000000000001000 <_init>: 1000: f3 0f 1e fa endbr64 1004: 48 83 ec 08 sub $0x8,%rsp 1008: 48 8b 05 d9 2f 00 00 mov 0x2fd9(%rip),%rax # 3fe8 <__gmon_start__> 100f: 48 85 c0 test %rax,%rax 1012: 74 02 je 1016 <_init+0x16> 1014: ff d0 call *%rax 1016: 48 83 c4 08 add $0x8,%rsp 101a: c3 ret Disassembly of section .plt: 0000000000001020 <printf@plt-0x10>: 1020: ff 35 e2 2f 00 00 push 0x2fe2(%rip) # 4008 <_GLOBAL_OFFSET_TABLE_+0x8> 1026: ff 25 e4 2f 00 00 jmp *0x2fe4(%r

megasync in linux

goto  https://mega.nz/sync  select mac/windows/linux and its distro for debian ::  wget https://mega.nz/linux/MEGAsync/Debian_10.0/amd64/megasync-Debian_10.0_amd64.deb     for archlinux https://mega.nz/linux/MEGAsync/Arch_Extra/x86_64/megasync-x86_64.pkg.tar.zst pacman -U

open classic personalization apps win 10

 classic  theme = shell:::{ED834ED6-4B5A-4bfe-8F11-A626DCB6A921} sound setting = rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl,,2 scren saver settings = rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,1 desktop settings = rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,0 mouse settings =rundll32.exe shell32.dll,Control_RunDLL main.cpl,,1 notifications icons = explorer shell:::{05d7b0f4-2121-4eff-bf6b-ed3f69b894d9} other clsid keys are  explorer shell:::{CLSID key} OR explorer /e,::{CLSID key} 3D Objects  (folder) {0DB7E03F-FC29-4DC6-9020-FF41B59E513A} Add Network Location {D4480A50-BA28-11d1-8E75-00C04FA31A86} Administrative Tools {D20EA4E1-3957-11d2-A40B-0C5020524153} Applications {4234d49b-0245-4df3-b780-3893943456e1} AutoPlay {9C60DE1E-E5FC-40f4-A487-460851A8D915} Backup and Restore (Windows 7) {B98A2BEA-7D42-4558-8BD1-832F41BAC6FD} BitLocker Drive Encryption {D9EF8727-CAC2-4e60-809E-86F80A666C91} Bluetooth Devices {28803F59-3A75-4058-995F-4EE5503B023C} Color Management {B2C

using 'and' 'or' with string in python

 short circuit evaluation is used for 'and' if first item is  0 result is  0 so  a and b results to a and b wont be evaluated if a is false(empty string,list etc) a and b gives a if a is false and b otherwise for or if first item is 1 result is 1 so  a or b gives a if a is true and b otherwise

python list

python list are passed by reference a=b=[1,2,3] id(a)==id(b) returns true i.e they have same memory address modifying a also modifies b. to make copy list use copy() or  new=old[:]

ntfs hidden files

 $Extend               A directory: $ObjId, $Quota, $Reparse, $UsnJrnl     $Deleted     $RmMetadata          $Txf          $Txflog          $Repair     $ObjId        Unique Ids given to every file     $Quota         Quota information     $Reparse      Reparse point information     $u=UsnJrnl    Journalling of Encryption $AttrDef           Attribute definitions $BadClus          Lists bad clusters on the volume $Bitmap           Contains volume's cluster map (in-use vs. free) $Boot                  Boot record of the volume $LogFile           Transactional logging file $MFT                 Master File Table - An index of every file $MFTMirr         A backup copy of the first 4 records of the MFT $Secure               Security descriptors used by the volume $UpCase             Table of uppercase characters used for collating $Volume            Serial number, creation time, dirty flag legend : blue = folder black= files src::  https://flatcap.org/linux-ntfs/ntfs/files/index.html https

lambda function in python

is used to create function without name(annonymous function). its one line function  syntax: lambda p1,p2,p3...pn :expression you can read ':' as 'such that' as  in set builder method  note: p1,p2...pn = function parameters there can be only one expression lambda function by itself  returns  a function object example sum=lambda a,b:a+b print(sum(1+2)) output  3 x=1 print(lambda x :  print(x)) output: <function <lambda> at 0xsomeaddress> we need to call function object to get result  IIFE stands for immediately invoked function execution syntax:: (lambda parameter: expression)(argument) example>> (lambda x :  print(x**2))(9) note: lambda function is treated as normal function by python interpreter

run as different user windows

runas /user:$computername\$username /savecred $commandname omit /savecred if u dont want to save credintals i.e reprompt password on next command use runas /user:$computername\$username  $commandname $computername= ur pc name (find by pressing win+x+y i.e system tab>device name or by using cmd  cmd  /k  hostname  ) or it can be name of  other pc on same network $username = username of the computer you want to login ( username lsit can be found by running net user) $commandname = app you want to run as different user example: runas /user:MEOW\kat /savecred cmd  to delete saved credintals use credintal manager in control panel or %APPDATA%\Microsoft\ Credentials delete files there for gui mode shift+right click gives option to run as different user

function in python

 functions in python are objects func.__code__  and  func.__defaults__ func.__code__  was  func.func_code   func.__defaults__  was  func.func_defaults in python 2 >The default values are stored in  func.__defaults__ , and retrieved each time the function is called. >the body of the function gets compiled and stored in variables under  __code__ >the default arguments get stored in  __defaults__ __annotations__ Function annotations are completely optional metadata information about the types used by user-defined functions Return annotations are defined by a literal ->, followed by an expression, between the parameter list and the colon denoting the end of the def statement __call__                     __class__ __closure__ __code__ __defaults__ __delattr__ __dict__ __dir__ __doc__ function documendation string :: short, concise summary of the object’s purpose written between triple quotes at start of function. __eq__ __format__ __ge__ __get__ __getattribute__ __globals_