Skip to content

Instantly share code, notes, and snippets.

@nasrulhazim
nasrulhazim / dowload-files-from-ftp-server-using-python3.md
Last active May 6, 2024 09:45
Download Files From FTP Server using Python3
from ftplib import FTP
from datetime import datetime

start = datetime.now()
ftp = FTP('your-ftp-domain-or-ip')
ftp.login('your-username','your-password')

# Get All Files
files = ftp.nlst()
@m5lil
m5lil / reset.sh
Last active May 6, 2024 09:44
[reset jetbrains application trial] reset jetbrains ide evals v1.0.4 #others
#!/bin/bash
# reset jetbrains ide evals v1.0.4
OS_NAME=$(uname -s)
JB_PRODUCTS="IntelliJIdea CLion PhpStorm GoLand PyCharm WebStorm Rider DataGrip RubyMine AppCode"
if [ "$OS_NAME" == "Darwin" ]; then
echo 'macOS:'
for PRD in $JB_PRODUCTS; do
function Export-MFT {
<#
.SYNOPSIS
Extracts master file table from volume.
Version: 0.1
Author : Jesse Davis (@secabstraction)
License: BSD 3-Clause
.DESCRIPTION
@cloud8421
cloud8421 / ms_test.exs
Created August 10, 2016 14:38
Maps and match specs in elixir
defmodule MsTest do
use ExUnit.Case
doctest Ms
@bob %{name: "Bob", job: "developer"}
@alice %{name: "Alice", job: "musician"}
@john %{name: "John", job: "musician"}
@ada %{name: "Ada", job: "developer"}
@alan %{name: "Alan", job: "developer"}
@table :users
@toolittlecakes
toolittlecakes / st_fixed_container.py
Last active May 6, 2024 09:38
Sticky/fixed container for streamlit apps. Supports dynamic width change as well as dynamic color updates. Both top/bottom positions are available.
from typing import Literal
import streamlit as st
from streamlit.components.v1 import html
FIXED_CONTAINER_CSS = """
:root {{
--background-color: #ffffff; /* Default background color */
}}
@wojteklu
wojteklu / clean_code.md
Last active May 6, 2024 09:35
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@jherax
jherax / filterArray.js
Last active May 6, 2024 09:35
Filters an array of objects with multiple match-criteria.
/**
* Filters an array of objects using custom predicates.
*
* @param {Array} array: the array to filter
* @param {Object} filters: an object with the filter criteria
* @return {Array}
*/
function filterArray(array, filters) {
const filterKeys = Object.keys(filters);
return array.filter(item => {
@bensig
bensig / bitcoin_fast_sync_ideas.md
Created March 3, 2023 20:02
Fast Sync Bitcoin Node - 3 Options

Option 1 - Use This Bitcoin Fast Sync Command

There is no torrent which would be faster than just using the Bitcoin network "hive" - which is huge. There may be a way to sync using local or low-latency nodes nearby, but any time you specify which nodes you sync from - it introduces risk.

Very good to have a fast CPU and lots of RAM, SSD is not as important as RAM.

With this command I was able to download the entire blockchain and create all indices in almost exactly 24 hours:

bitcoind --datadir=<path-to-external-ssd> -blockfilterindex=1 -txindex=1 -coinstatsindex=1 -dbcache=16384 -daemon If you have 32GB of RAM, you can use 32768 for dbcache

@johnko
johnko / gist:66515a2db2aa22aa51bd
Last active May 6, 2024 09:31
How to iPXE boot from http iso on www.vultr.com

If your custom iso is not mounting, and your console is at an iPXE shell, you can:

initrd http://mfsbsd.vx.sk/files/iso/10/amd64/mfsbsd-se-10.1-RELEASE-amd64.iso

While the iso is downloading, vultr's iPXE does not include memdisk, so we have to upload it ourselves to another host.

Here's one I found public, though I wouldn't recommend using it: http://preseed.panticz.de/ipxe/memdisk