Skip to content

Instantly share code, notes, and snippets.

@uttaravadina
uttaravadina / learn.md
Created November 13, 2021 17:49 — forked from rylev/learn.md
How to Learn Rust

Learning Rust

The following is a list of resources for learning Rust as well as tips and tricks for learning the language faster.

Warning

Rust is not C or C++ so the way your accustomed to do things in those languages might not work in Rust. The best way to learn Rust is to embrace its best practices and see where that takes you.

The generally recommended path is to start by reading the books, and doing small coding exercises until the rules around borrow checking become intuitive. Once this happens, then you can expand to more real world projects. If you find yourself struggling hard with the borrow checker, seek help. It very well could be that you're trying to solve your problem in a way that goes against how Rust wants you to work.

@uttaravadina
uttaravadina / README.md
Created July 19, 2021 20:22 — forked from lithdew/README.md
Differences between Linux and Mac for sockets.
  1. A listening socket blocked on accept() can be unblocked by calling shutdown(socket_fd, SHUT_RD) on Linux. On Mac, calling shutdown(socket_fd, SHUT_RD) on a listening socket that is blocked on accept() will return an error ENOTCONN. To unblock a listening socket blocked on accept() on Mac requires calling close(socket_fd), which will cause the blocking accept() call to return an error EBADF.

Therefore, in order to unblock a socket on accept() on both Mac/Linux, shutdown() should not be relied on. Rather, an async cancellation scheme (such as cancellation tokens in .NET) should be used instead to unblock the call to accept().

  1. When a socket is instantiated and subsequently registered to epoll, or when a socket is shut down (via. shutdown() or setsockopt(SO_LINGER)) on Linux, epoll will be notified with EPOLLHUP on the socket. On Mac, kqueue will only notify when a socket is shut down (via. shutdown() or setsockopt(SO_LINGER)) by sending a EV_EOF notification on filters EVFILT_READ, and EVFILT_WRITE.

Thi

@uttaravadina
uttaravadina / README.md
Created July 4, 2021 01:00 — forked from cerebrate/README.md
Recompile your WSL2 kernel - support for snaps, apparmor, lxc, etc.

NOTE

See https://gist.github.com/cerebrate/d40c89d3fa89594e1b1538b2ce9d2720#gistcomment-3563688 below before doing anything else.

Recompile your WSL2 kernel - support for snaps, apparmor, lxc, etc.

Yes, I've done this, and yes, it works. It is, however, entirely unsupported and assembled through reasonable guesswork, so if you try this and it explodes your computer, brain, career, relationships, or anything else, you agree that you take sole responsibility for doing it, that I never claimed it was a good idea, and that you didn't get these instructions from me .

@uttaravadina
uttaravadina / memory_layout.md
Created April 15, 2021 14:41 — forked from CMCDragonkai/memory_layout.md
Linux: Understanding the Memory Layout of Linux Executables

Understanding the Memory Layout of Linux Executables

Required tools for playing around with memory:

  • hexdump
  • objdump
  • readelf
  • xxd
  • gcore
@uttaravadina
uttaravadina / pytz-time-zones.py
Created April 12, 2021 12:04 — forked from heyalexej/pytz-time-zones.py
list of pytz time zones
>>> import pytz
>>>
>>> for tz in pytz.all_timezones:
... print tz
...
...
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
@uttaravadina
uttaravadina / Correct_GnuPG_Permission.sh
Created April 6, 2021 10:18 — forked from oseme-techguy/Correct_GnuPG_Permission.sh
This fixes the " gpg: WARNING: unsafe permissions on homedir '/home/path/to/user/.gnupg' " error while using Gnupg .
#!/usr/bin/env bash
# To fix the " gpg: WARNING: unsafe permissions on homedir '/home/path/to/user/.gnupg' " error
# Make sure that the .gnupg directory and its contents is accessibile by your user.
chown -R $(whoami) ~/.gnupg/
# Also correct the permissions and access rights on the directory
chmod 600 ~/.gnupg/*
chmod 700 ~/.gnupg
@uttaravadina
uttaravadina / ascii_arty.py
Created March 29, 2021 01:07 — forked from jdiaz5513/ascii_arty.py
Console ASCII Art Generator
#! /usr/bin/env python2
# Requires: PIL, colormath
#
# Improved algorithm now automatically crops the image and uses much
# better color matching
from PIL import Image, ImageChops
from colormath.color_conversions import convert_color
from colormath.color_objects import LabColor
from colormath.color_objects import sRGBColor as RGBColor
@uttaravadina
uttaravadina / hex_to_ansi
Created March 29, 2021 01:07 — forked from pieman72/hex_to_ansi
Hex to ANSI color code converter
function hex_to_ansi(){
# Get the individual color components as decimals
HEX=$(echo "$1" | tr -d '#' | tr '[:lower:]' '[:upper:]')
DIGITS=$(( ${#HEX} / 3 ))
R=$(( 16#${HEX:$(( DIGITS * 0 )):$DIGITS} ))
G=$(( 16#${HEX:$(( DIGITS * 1 )):$DIGITS} ))
B=$(( 16#${HEX:$(( DIGITS * 2 )):$DIGITS} ))
# Handle grey ramp
if [ "`echo $(( R-G )) | tr -d '-'`" -lt 16 ]\
@uttaravadina
uttaravadina / tiny_program.s
Created February 19, 2021 21:26 — forked from GustavoARSilva/tiny_program.s
Tiny Assembly program
@ This program counts all the even numbers cointained in the range from 0 to 10
@ in reverse order, this is: 10 + 8 + 6 + 4 + 2 = 30
@ Constants definition.
.equ STACK_TOP, 0x20000800
.text
@ The symbol _start is required by the GNU Linker to specify
@ the first instruction to be executed in a program.
.global _start
* Downloaded or downloading
=============================
**http://kickass.to/infiniteskills-learning-jquery-mobile-working-files-t7967156.html
**http://kickass.to/lynda-bootstrap-3-advanced-web-development-2013-eng-t8167587.html
**http://kickass.to/lynda-css-advanced-typographic-techniques-t7928210.html
**http://kickass.to/lynda-html5-projects-interactive-charts-2013-eng-t8167670.html
**http://kickass.to/vtc-html5-css3-responsive-web-design-course-t7922533.html
*http://kickass.to/10gen-m101js-mongodb-for-node-js-developers-2013-eng-t8165205.html
*http://kickass.to/cbt-nuggets-amazon-web-services-aws-foundations-t7839734.html